/** * Toggles the unfolding of the details area. This is triggered by the user * pressing the details button. */ private void toggleDetailsArea() { boolean opened = false; Point windowSize = getShell().getSize(); if (listCreated) { list.dispose(); listCreated = false; detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); opened = false; } else { list = createDropDownList((Composite) getContents()); detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); getContents().getShell().layout(); opened = true; } Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); int diffY = newSize.y - windowSize.y; // increase the dialog height if details were opened and such increase is necessary // decrease the dialog height if details were closed and empty space appeared if ((opened && diffY > 0) || (!opened && diffY < 0)) { getShell().setSize(new Point(windowSize.x, windowSize.y + (diffY))); } }
/** * Toggles the unfolding of the details area. This is triggered by the user * pressing the details button. */ private void toggleDetailsArea() { boolean opened = false; Point windowSize = getShell().getSize(); if (listCreated) { list.dispose(); listCreated = false; detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); opened = false; } else { list = createDropDownList((Composite) getContents()); detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); getContents().getShell().layout(); opened = true; } Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); int diffY = newSize.y - windowSize.y; // increase the dialog height if details were opened and such increase is necessary // decrease the dialog height if details were closed and empty space appeared if ((opened && diffY > 0) || (!opened && diffY < 0)) { getShell().setSize(new Point(windowSize.x, windowSize.y + (diffY))); } }
/** * Toggles the unfolding of the details area. This is triggered by the user * pressing the details button. */ private void toggleDetailsArea() { Point windowSize = getShell().getSize(); Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); if (listCreated) { list.dispose(); listCreated = false; detailsButton.setText(IDialogConstants.get().SHOW_DETAILS_LABEL); } else { list = createDropDownList((Composite) getContents()); detailsButton.setText(IDialogConstants.get().HIDE_DETAILS_LABEL); getContents().getShell().layout(); } Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell() .setSize( new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); }