Example usage for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING

List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.

Prototype

int VERTICAL_SPACING

To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.

Click Source Link

Document

Vertical spacing in dialog units (value 4).

Usage

From source file:org.eclipse.birt.report.extension.barcode.BarCodeBuilder.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/* w w  w .j  a  v a 2 s  .co m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTextArea(composite);

    Label lb = new Label(composite, SWT.None);
    lb.setText("Barcode Type:"); //$NON-NLS-1$

    barCodeType = new ComboViewer(composite, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    //      barCodeType.add("");
    //      for (String bcType : BAR_CODE_TYPES) {
    //         barCodeType.add(bcType);
    //      }
    barCodeType.setContentProvider(ArrayContentProvider.getInstance());
    barCodeType.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return ((BarCodeGenerator) element).getLabel();
        }
    });
    barCodeType.setInput(BarCodeGenerator.values());
    GridData gd = new GridData();
    gd.widthHint = 100;
    barCodeType.getControl().setLayoutData(gd);

    applyDialogFont(composite);

    try {
        initValues();
    } catch (SemanticException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return composite;
}

From source file:org.eclipse.birt.sample.reportitem.rotatedtext.RotatedTextBuilder.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/* w  w  w .j a va 2s . c o m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTextArea(composite);

    Label lb = new Label(composite, SWT.None);
    lb.setText("Rotation Angle:"); //$NON-NLS-1$

    sclAngle = new Scale(composite, SWT.None);
    sclAngle.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sclAngle.setMinimum(0);
    sclAngle.setMaximum(360);
    sclAngle.setIncrement(10);

    lbAngle = new Label(composite, SWT.None);
    GridData gd = new GridData();
    gd.widthHint = 20;
    lbAngle.setLayoutData(gd);

    sclAngle.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
            lbAngle.setText(String.valueOf(sclAngle.getSelection()));
        }

        public void widgetSelected(SelectionEvent e) {
            lbAngle.setText(String.valueOf(sclAngle.getSelection()));
        }
    });

    applyDialogFont(composite);

    initValues();

    return composite;
}

From source file:org.eclipse.cdt.core.testplugin.util.VerifyDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, SWT.NONE);
    composite.setSize(SIZING_WIDTH, SWT.DEFAULT);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/* ww  w  .j a va2s.  co m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTestSelectionGroup(composite);
    createCheckListGroup(composite);

    _queryLabel = new Label(composite, SWT.NONE);
    _queryLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    initializeTest();
    return composite;
}

From source file:org.eclipse.cdt.cpp.ui.internal.dialogs.CustomMessageDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;// w  w  w  .j  av a  2 s.com
    composite.setLayout(layout);

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);

    composite.setFont(parent.getFont());
    // create composite for the don't show button
    Composite leftPane = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout leftPaneLayout = new GridLayout();
    leftPaneLayout.numColumns = 1;
    leftPaneLayout.makeColumnsEqualWidth = true;
    leftPaneLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    leftPaneLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    leftPaneLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    leftPaneLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    leftPane.setLayout(leftPaneLayout);

    GridData leftPaneData = new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_CENTER);
    leftPane.setLayoutData(leftPaneData);

    // Add a check box if needed
    if (extraButtonLabels != null)
        createExtraButtonsForButtonBar(leftPane);
    // create composite to hold the butons
    Composite rightPane = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout rightPaneLayout = new GridLayout();
    rightPaneLayout.numColumns = 0; // this is incremented by createButton
    rightPaneLayout.makeColumnsEqualWidth = true;
    rightPaneLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    rightPaneLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    rightPaneLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    rightPaneLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    rightPane.setLayout(rightPaneLayout);

    GridData rightPanedata = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    rightPane.setLayoutData(rightPanedata);
    // Add the buttons to the button bar.
    createButtonsForButtonBar(rightPane);
    return composite;
}

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.CompilationDirectorySourceContainerDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Image image = fNewContainer ? CDebugImages.get(IInternalCDebugUIConstants.IMG_ADD_COMP_DIR_WIZ)
            : CDebugImages.get(IInternalCDebugUIConstants.IMG_EDIT_COMP_DIR_WIZ);
    setTitle(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_2);
    setMessage(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_3);
    setTitleImage(image);// w w  w .  java 2  s.c o  m
    Composite parentComposite = (Composite) super.createDialogArea(parent);
    Font font = parentComposite.getFont();
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(font);

    Composite dirComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout(2, false);
    dirComposite.setLayout(layout);
    dirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    dirComposite.setFont(font);

    Label label = new Label(dirComposite, SWT.NONE);
    label.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_4);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    label.setFont(font);

    fDirText = new Text(dirComposite, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 1;
    fDirText.setLayoutData(data);
    fDirText.setFont(font);
    fDirText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });

    Button button = new Button(dirComposite, SWT.PUSH);
    button.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_5);
    data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    data.widthHint = Math.max(widthHint, minSize.x);
    button.setLayoutData(data);
    button.setFont(JFaceResources.getDialogFont());
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            browse();
        }
    });

    fSubfoldersButton = new Button(dirComposite, SWT.CHECK);
    fSubfoldersButton.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_6);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalIndent = layout.verticalSpacing; // Extra vertical spacing
    fSubfoldersButton.setLayoutData(data);
    fSubfoldersButton.setFont(font);

    return parentComposite;
}

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.PathMappingDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    setTitle(SourceLookupUIMessages.PathMappingDialog_11);
    setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING));

    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from   w w w .j  ava2 s . c om
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    composite.setFont(font);

    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
            ICDebugHelpContextIds.SOURCE_PATH_MAPPING_DIALOG);

    Composite nameComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    nameComp.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    nameComp.setLayoutData(data);
    nameComp.setFont(font);

    Label label = new Label(nameComp, SWT.LEFT);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    label.setLayoutData(data);
    label.setFont(font);
    label.setText(SourceLookupUIMessages.PathMappingDialog_12);
    fNameText = new Text(nameComp, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    fNameText.setLayoutData(data);
    fNameText.setFont(font);
    fNameText.setText(getMapping().getName());
    fNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
        }
    });

    fViewer = createViewer(composite);
    data = new GridData(GridData.FILL_BOTH);
    fViewer.getControl().setLayoutData(data);
    fViewer.getControl().setFont(font);
    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateButtons();
        }
    });

    Composite buttonComp = new Composite(composite, SWT.NONE);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.marginHeight = 0;
    buttonLayout.marginWidth = 0;
    buttonComp.setLayout(buttonLayout);
    data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    buttonComp.setLayoutData(data);
    buttonComp.setFont(font);

    GC gc = new GC(parent);
    gc.setFont(parent.getFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    fAddButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_13, fontMetrics);
    fAddButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntryDialog dialog = new MapEntryDialog(getShell());
            if (dialog.open() == Window.OK) {
                getViewer().refresh();
            }
        }
    });

    fEditButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_14, fontMetrics);
    fEditButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            if (entries.length > 0) {
                MapEntryDialog dialog = new MapEntryDialog(getShell(), entries[0]);
                if (dialog.open() == Window.OK) {
                    getViewer().refresh();
                }
            }
        }
    });

    fRemoveButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_15, fontMetrics);
    fRemoveButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            for (int i = 0; i < entries.length; ++i) {
                fMapping.removeMapEntry(entries[i]);
            }
            getViewer().refresh();
        }
    });

    setMessage(null);
    fViewer.setInput(fMapping);

    return composite;
}

From source file:org.eclipse.cdt.internal.ui.filters.CustomFiltersDialog.java

License:Open Source License

/**
 * Overrides method in Dialog//from  w w  w  .  j  a v a2  s  .  co  m
 * 
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
 */
@Override
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    Composite group = composite;

    // Checkbox
    fEnableUserDefinedPatterns = new Button(group, SWT.CHECK);
    fEnableUserDefinedPatterns.setText(FilterMessages.CustomFiltersDialog_enableUserDefinedPattern);

    // Pattern   field
    fUserDefinedPatterns = new Text(group, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = convertWidthInCharsToPixels(59);
    fUserDefinedPatterns.setLayoutData(data);
    String patterns = convertToString(fPatterns, SEPARATOR);
    fUserDefinedPatterns.setText(patterns);

    // Info text
    final Label info = new Label(group, SWT.LEFT);
    info.setText(FilterMessages.CustomFiltersDialog_patternInfo);

    // Enabling / disabling of pattern group
    fEnableUserDefinedPatterns.setSelection(fEnablePatterns);
    fUserDefinedPatterns.setEnabled(fEnablePatterns);
    info.setEnabled(fEnablePatterns);
    fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean state = fEnableUserDefinedPatterns.getSelection();
            fUserDefinedPatterns.setEnabled(state);
            info.setEnabled(fEnableUserDefinedPatterns.getSelection());
            if (state)
                fUserDefinedPatterns.setFocus();
        }
    });

    // Filters provided by extension point
    if (fBuiltInFilters.length > 0)
        createCheckBoxList(group);

    applyDialogFont(parent);
    return parent;
}

From source file:org.eclipse.cdt.internal.ui.preferences.formatter.CreateProfileDialog.java

License:Open Source License

@Override
public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    GridData gd;//from   www . j  a v a2s. c om

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(layout);

    // Create "Profile name:" label
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    final Label nameLabel = new Label(composite, SWT.WRAP);
    nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text);
    nameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });

    // Create "Initialize settings ..." label
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    Label profileLabel = new Label(composite, SWT.WRAP);
    profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text);
    profileLabel.setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    fProfileCombo.setLayoutData(gd);

    // "Open the edit dialog now" checkbox
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    fEditCheckbox = new Button(composite, SWT.CHECK);
    fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text);
    fEditCheckbox.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fOpenEditDialog = ((Button) e.widget).getSelection();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    final IDialogSettings dialogSettings = CUIPlugin.getDefault().getDialogSettings();//.get(PREF_OPEN_EDIT_DIALOG);
    if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) {
        fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG);
    } else {
        fOpenEditDialog = true;
    }
    fEditCheckbox.setSelection(fOpenEditDialog);

    fProfileCombo.setItems(fSortedNames);
    fProfileCombo.setText(fProfileManager.getDefaultProfile().getName());
    updateStatus(fEmpty);

    applyDialogFont(composite);

    fNameText.setFocus();

    return composite;
}

From source file:org.eclipse.cdt.internal.ui.preferences.formatter.ModifyDialogTabPage.java

License:Open Source License

/**
 * Create the contents of this tab page. Subclasses cannot override this, 
 * instead they must implement <code>doCreatePreferences</code>. <code>doCreatePreview</code> may also
 * be overridden as necessary./*from  w  w  w .j ava2  s .  c om*/
 * @param parent The parent composite
 * @return Created content control
 */
@Override
public final Composite createContents(Composite parent) {
    final int numColumns = 4;

    if (fPixelConverter == null) {
        fPixelConverter = new PixelConverter(parent);
    }

    final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
    sashForm.setFont(parent.getFont());

    Composite scrollContainer = new Composite(sashForm, SWT.NONE);

    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    scrollContainer.setLayoutData(gridData);

    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    scrollContainer.setLayout(layout);

    ScrolledComposite scroll = new ScrolledComposite(scrollContainer, SWT.V_SCROLL | SWT.H_SCROLL);
    scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scroll.setExpandHorizontal(true);
    scroll.setExpandVertical(true);

    final Composite settingsContainer = new Composite(scroll, SWT.NONE);
    settingsContainer.setFont(sashForm.getFont());

    scroll.setContent(settingsContainer);

    settingsContainer.setLayout(new PageLayout(scroll, 400, 400));
    settingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite settingsPane = new Composite(settingsContainer, SWT.NONE);
    settingsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = (int) (1.5
            * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING));
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    settingsPane.setLayout(layout);
    doCreatePreferences(settingsPane, numColumns);

    settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scroll.addControlListener(new ControlListener() {

        @Override
        public void controlMoved(ControlEvent e) {
        }

        @Override
        public void controlResized(ControlEvent e) {
            settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }
    });

    Label sashHandle = new Label(scrollContainer, SWT.SEPARATOR | SWT.VERTICAL);
    gridData = new GridData(SWT.RIGHT, SWT.FILL, false, true);
    sashHandle.setLayoutData(gridData);

    final Composite previewPane = new Composite(sashForm, SWT.NONE);
    previewPane.setLayout(createGridLayout(numColumns, true));
    previewPane.setFont(sashForm.getFont());
    doCreatePreviewPane(previewPane, numColumns);

    initializePage();

    sashForm.setWeights(new int[] { 3, 3 });
    return sashForm;
}

From source file:org.eclipse.cdt.launchbar.ui.internal.dialogs.LaunchConfigurationEditDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    // Clone super's implementation, removes the monitor since we don't run from here
    // And adds in the left button bar.
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from w w  w. j  a va2s .  c om
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(font);

    // create help control if needed
    if (isHelpAvailable()) {
        createHelpControl(composite);
    }

    Composite leftButtonComp = new Composite(composite, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.numColumns = 0;
    leftButtonComp.setLayout(layout);
    leftButtonComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    leftButtonComp.setFont(parent.getFont());

    createButton(leftButtonComp, DELETE_ID, "Delete", false);
    createButton(leftButtonComp, DUPLICATE_ID, "Duplicate", false);
    createButton(leftButtonComp, LAUNCH_ID, "Launch", false);

    Composite mainButtonComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.numColumns = 0;
    mainButtonComp.setLayout(layout);
    mainButtonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    mainButtonComp.setFont(parent.getFont());

    createButton(mainButtonComp, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(mainButtonComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    return composite;
}