@Override protected Control createDialogArea(Composite ancestor) { Composite parent = (Composite) super.createDialogArea(ancestor); final int nOfColumns = 4; initializeDialogUnits(ancestor); GridLayout layout = (GridLayout) parent.getLayout(); layout.numColumns = nOfColumns; parent.setLayout(layout); createAccessorPart(parent, nOfColumns, convertWidthInCharsToPixels(40)); Separator s = new Separator(SWT.SEPARATOR | SWT.HORIZONTAL); s.doFillIntoGrid(parent, nOfColumns); createPropertyPart(parent, nOfColumns, convertWidthInCharsToPixels(40)); Dialog.applyDialogFont(parent); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(parent, IJavaHelpContextIds.EXTERNALIZE_WIZARD_PROPERTIES_FILE_PAGE); validateAll(); return parent; }
private void createLabel(Composite parent, final String text, final int N_OF_COLUMNS) { Separator label = new Separator(SWT.NONE); ((Label) label.getSeparator(parent)).setText(text); GC gc = new GC(parent); int height = gc.stringExtent(text).y; gc.dispose(); label.doFillIntoGrid(parent, N_OF_COLUMNS, height); }