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

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

Introduction

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

Prototype

int HORIZONTAL_MARGIN

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

Click Source Link

Document

Horizontal margin in dialog units (value 7).

Usage

From source file:ext.org.eclipse.jdt.internal.ui.dialogs.SourceActionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);/*from w  w w  . j a v  a2  s .  co  m*/

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    GridData gd = null;

    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);

    Label messageLabel = createMessageArea(composite);
    if (messageLabel != null) {
        gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        gd.horizontalSpan = 2;
        messageLabel.setLayoutData(gd);
    }

    Composite inner = new Composite(composite, SWT.NONE);
    GridLayout innerLayout = new GridLayout();
    innerLayout.numColumns = 2;
    innerLayout.marginHeight = 0;
    innerLayout.marginWidth = 0;
    inner.setLayout(innerLayout);
    inner.setFont(parent.getFont());

    CheckboxTreeViewer treeViewer = createTreeViewer(inner);
    gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertWidthInCharsToPixels(fWidth);
    gd.heightHint = convertHeightInCharsToPixels(fHeight);
    treeViewer.getControl().setLayoutData(gd);

    Composite buttonComposite = createSelectionButtons(inner);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    buttonComposite.setLayoutData(gd);

    gd = new GridData(GridData.FILL_BOTH);
    inner.setLayoutData(gd);

    fInsertPositionComposite = createInsertPositionCombo(composite);
    fInsertPositionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite commentComposite = createCommentSelection(composite);
    commentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Control linkControl = createLinkControl(composite);
    if (linkControl != null)
        linkControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    gd = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gd);

    applyDialogFont(composite);

    return composite;
}

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

License:Open Source License

/**
 * Overrides method in Dialog//  w w  w.j  a  v a  2 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.setFocus();
    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);
    SWTUtil.setAccessibilityText(fUserDefinedPatterns,
            FilterMessages.CustomFiltersDialog_name_filter_pattern_description);

    // 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:ext.org.eclipse.jdt.internal.ui.jarimport.JarImportWizardPage.java

License:Open Source License

/**
 * Creates the rename group./*ww w .ja  va  2 s  . c o m*/
 *
 * @param parent
 *            the parent control
 */
protected void createRenameGroup(final Composite parent) {
    Assert.isNotNull(parent);
    final JarImportData data = fWizard.getImportData();
    final Button button = new Button(parent, SWT.CHECK);
    button.setText(JarImportMessages.JarImportWizardPage_replace_jar_file);
    button.setSelection(!data.isRenameJarFile());
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            data.setRenameJarFile(!button.getSelection());
        }
    });
    if (fImportWizard && !fTreeViewer.getControl().isEnabled())
        button.setEnabled(false);
    if (!fImportWizard) {
        final GridData gd = new GridData();
        gd.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
        button.setLayoutData(gd);
    }
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*from w w w  .  j av a  2s . 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);

    parent.setLayout(layout);
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));

    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doTextWidgetChanged(e.widget);
        }
    };

    if (fIsNameModifiable) {
        createLabel(parent, PreferencesMessages.EditTemplateDialog_name);

        Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        layout = new GridLayout();
        layout.numColumns = 4;
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        composite.setLayout(layout);

        fNameText = createText(composite);
        fNameText.addFocusListener(new FocusListener() {

            public void focusGained(FocusEvent e) {
            }

            public void focusLost(FocusEvent e) {
                if (fSuppressError) {
                    fSuppressError = false;
                    updateStatusAndButtons();
                }
            }
        });

        createLabel(composite, PreferencesMessages.EditTemplateDialog_context);
        fContextCombo = new Combo(composite, SWT.READ_ONLY);
        SWTUtil.setDefaultVisibleItemCount(fContextCombo);

        for (int i = 0; i < fContextTypes.length; i++) {
            fContextCombo.add(fContextTypes[i][1]);
        }

        fContextCombo.addModifyListener(listener);

        fAutoInsertCheckbox = createCheckbox(composite, PreferencesMessages.EditTemplateDialog_autoinsert);
        fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable());
    }

    createLabel(parent, PreferencesMessages.EditTemplateDialog_description);

    int descFlags = fIsNameModifiable ? SWT.BORDER : SWT.BORDER | SWT.READ_ONLY;
    fDescriptionText = new Text(parent, descFlags);
    fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fDescriptionText.addModifyListener(listener);

    Label patternLabel = createLabel(parent, PreferencesMessages.EditTemplateDialog_pattern);
    patternLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    fPatternEditor = createEditor(parent);

    Label filler = new Label(parent, SWT.NONE);
    filler.setLayoutData(new GridData());

    Composite composite = new Composite(parent, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData());

    fInsertVariableButton = new Button(composite, SWT.NONE);
    fInsertVariableButton.setLayoutData(getButtonGridData());
    fInsertVariableButton.setText(PreferencesMessages.EditTemplateDialog_insert_variable);
    fInsertVariableButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fPatternEditor.getTextWidget().setFocus();
            fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
        }

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

    fDescriptionText.setText(fTemplate.getDescription());
    if (fIsNameModifiable) {
        fNameText.setText(fTemplate.getName());
        fNameText.addModifyListener(listener);
        fContextCombo.select(getIndex(fTemplate.getContextTypeId()));
    } else {
        fPatternEditor.getControl().setFocus();
    }
    initializeActions();

    applyDialogFont(parent);
    return composite;
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.formatter.OffOnTagsTabPage.java

License:Open Source License

@Override
public final Composite createContents(Composite parent) {
    if (fPixelConverter == null)
        fPixelConverter = new PixelConverter(parent);

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData());

    final int numColumns = 2;
    GridLayout 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);
    composite.setLayout(layout);/*  w w w.ja v a2 s . c om*/
    doCreatePreferences(composite, numColumns);

    return composite;
}

From source file:ext.org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.java

License:Open Source License

/**
 * Informs the user about the fact that there are no enabled categories in the default content
 * assist set and shows a link to the preferences.
 *
 * @return  <code>true</code> if the default should be restored
 * @since 3.3/*from w w  w  . j ava  2  s. c o m*/
 */
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = JavaPlugin.getActiveWorkbenchShell();
        String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = JavaTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                JavaTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final int settingsId = IDialogConstants.CLIENT_ID + 11;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /* default image */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*
             * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        setReturnCode(settingsId);
                        close();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                // create checkbox and "don't show this message" prompt
                super.createCustomArea(parent);

                return parent;
            }

            /*
             * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }
        };
        int returnValue = dialog.open();
        if (restoreId == returnValue || settingsId == returnValue) {
            if (restoreId == returnValue) {
                IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
                store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue)
                PreferencesUtil
                        .createPreferenceDialogOn(shell,
                                "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                        .open();
            fComputerRegistry.reload();
            return true;
        }
    }
    return false;
}

From source file:fede.plugin.workspace.filters.CustomFiltersDialog.java

License:Apache License

/**
 * Overrides method in Dialog/*from w  w  w  . ja v  a 2 s .  c o  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.setFocus();
    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:gov.nasa.ensemble.core.plan.editor.lifecycle.TransferableFilePlanChooser.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // Make view//from   w  w w .  j  a  v  a2  s .c om
    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));
    // Make file dialog
    FileDialog fileDialog = new FileDialog(parent.getShell(), SWT.OPEN);
    fileDialog.setText("Open");
    // the current workspace
    String path = Platform.getInstanceLocation().getURL().getPath();
    fileDialog.setFilterPath(path);
    //        fileDialog.setFilterPath(System.getProperty("user.dir"));
    String[] filterExt = { "*.spife", "*.*" };
    fileDialog.setFilterExtensions(filterExt);
    selectedFileName = fileDialog.open();
    //  if (selectedFileName == null)
    return null;
}

From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite root) {
    final Composite composite = new Composite(root, SWT.NONE);
    final 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);//from w  ww  .  j a va  2s .  co m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    final GridLayout gridLayout = new GridLayout(3, false);
    final GridDataFactory textFactory = GridDataFactory.fillDefaults().grab(true, false).span(2, 1);
    final GridData data;

    final Group domainManagerGroup = new Group(composite, SWT.NULL);

    domainManagerGroup.setText("Domain Manager");
    domainManagerGroup.setLayout(gridLayout);
    domainManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    Label label = new Label(domainManagerGroup, SWT.NULL);
    label.setText("Domain Name: ");
    Text text = new Text(domainManagerGroup, SWT.BORDER);
    data = textFactory.create();
    data.horizontalSpan = 2;
    text.setLayoutData(data);
    this.nameBinding = this.context.bindValue(SWTObservables.observeText(text, SWT.Modify),
            PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DOMAIN_NAME),
            new UpdateValueStrategy().setAfterConvertValidator(this.nameValidator), null);
    text.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            updateButtonsEnableState((IStatus) LaunchDomainManagerWithOptionsDialog.this.nameBinding
                    .getValidationStatus().getValue());
        }
    });

    ControlDecorationSupport.create(this.nameBinding, SWT.TOP | SWT.LEFT);

    label = new Label(domainManagerGroup, SWT.NULL);
    label.setText("Debug Level: ");
    ComboViewer debugViewer = new ComboViewer(domainManagerGroup,
            SWT.READ_ONLY | SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER);
    debugViewer.setLabelProvider(new LabelProvider());
    debugViewer.setContentProvider(new ArrayContentProvider());
    debugViewer.setInput(DebugLevel.values());
    debugViewer.getControl().setLayoutData(data);
    this.context.bindValue(ViewersObservables.observeSingleSelection(debugViewer),
            PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DEBUG_LEVEL));

    label = new Label(domainManagerGroup, SWT.NULL);
    label.setText("Arguments:");
    text = new Text(domainManagerGroup, SWT.BORDER);
    text.setLayoutData(data);
    this.context.bindValue(SWTObservables.observeText(text, SWT.Modify),
            PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_ARGUMENTS));

    final Group deviceManagerGroup = new Group(composite, SWT.NULL);

    deviceManagerGroup.setText("Device Manager");
    deviceManagerGroup.setLayout(GridLayoutFactory.fillDefaults().create());
    deviceManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    deviceManagerGroup.setVisible(!this.sdrRoot.getNodesContainer().getNodes().isEmpty());

    final CheckboxTreeViewer treeViewer = createTreeViewer(deviceManagerGroup);
    treeViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final Control buttonComposite = createSelectionButtons(deviceManagerGroup);
    buttonComposite.setLayoutData(GridDataFactory.fillDefaults().create());

    context.bindSet(ViewersObservables.observeCheckedElements(treeViewer, DeviceConfiguration.class), nodes);

    // Insert a progress monitor
    this.progressMonitorPart = createProgressMonitorPart(composite, new GridLayout());
    final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    this.progressMonitorPart.setLayoutData(gridData);
    this.progressMonitorPart.setVisible(false);

    // Build the separator line
    final Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Dialog.applyDialogFont(composite);

    getShell().getDisplay().asyncExec(new Runnable() {
        @Override
        public void run() {
            try {
                LaunchDomainManagerWithOptionsDialog.this.run(true, true, scanForTakenDomainNames);
                updateButtonsEnableState(Status.OK_STATUS);
            } catch (final InvocationTargetException e) {
                SdrUiPlugin.getDefault().getLog().log(
                        new Status(IStatus.ERROR, SdrUiPlugin.PLUGIN_ID, "Error scanning for domain names", e));
            } catch (final InterruptedException e) {
                updateButtonsEnableState(Status.OK_STATUS);
            }
        }
    });

    return composite;
}

From source file:hydrograph.ui.parametergrid.dialog.ParamterValueDialog.java

License:Apache License

@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.//www  .  ja va2 s.co  m
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN - 4);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING - 2);

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

    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Add the buttons to the button bar.
    createButtonsForButtonBar(composite);
    return composite;
}