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:ext.org.eclipse.jdt.internal.ui.filters.CustomFiltersDialog.java

License:Open Source License

/**
 * Overrides method in Dialog// w  w  w .  ja  v a2  s  .com
 *
 * @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.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  2  s . c  o m*/
    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);//from w ww  .  j a v a 2 s . c  om
    doCreatePreferences(composite, numColumns);

    return composite;
}

From source file:ext.org.eclipse.jdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);//from  ww w  .ja  va2  s . co m

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label infoLabel = new Label(messageComposite, SWT.WRAP);
    infoLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_select_strategy);
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    infoLabel.setLayoutData(gd);
    infoLabel.setFont(parent.getFont());

    int indent = convertWidthInCharsToPixels(3);

    fExactStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fExactStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_1);
    fExactStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fExactStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EXACT);
    LayoutUtil.setHorizontalIndent(fExactStrategyRadio.getSelectionButton(null), indent);

    fEmbeddedStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fEmbeddedStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_2);
    fEmbeddedStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fEmbeddedStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EMBEDDED);
    LayoutUtil.setHorizontalIndent(fEmbeddedStrategyRadio.getSelectionButton(null), indent);

    fSuffixStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fSuffixStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_3);
    fSuffixStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fSuffixStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_SUFFIX);
    LayoutUtil.setHorizontalIndent(fSuffixStrategyRadio.getSelectionButton(null), indent);

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    fWarningImageLabel = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    fWarningImageLabel.setImage(image);
    fWarningImageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    fWarningLabel = new Label(warningComposite, SWT.WRAP);
    fWarningLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_warning_short_names);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    fWarningLabel.setLayoutData(gridData);
    fWarningLabel.setFont(warningComposite.getFont());

    fExactStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EXACT;
        }
    });

    fEmbeddedStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EMBEDDED;
        }
    });

    fSuffixStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_SUFFIX;
        }
    });

    updateLabel();

    return messageComposite;
}

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

License:Apache License

/**
 * Overrides method in Dialog//from  ww w.  j a  va  2s.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/*w w  w  .j a  va2  s. c o  m*/
    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);//  www .j ava2 s  .  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.//from  w  w  w  . j  a v a  2  s  .  c o 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;
}

From source file:melnorme.lang.ide.ui.utils.StatusMessageDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    createMessageArea(composite);//www.  j a v  a2s .  c  o  m

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING) * 2;
    layout.numColumns = 2;
    composite.setLayout(layout);

    ignore = SWTFactory.createButton(parent, SWT.CHECK, ignoreButtonLabel,
            GridDataFactory.swtDefaults().span(2, 1).create());
    ignore.setSelection(true);

    return composite;
}

From source file:melnorme.util.swt.MetricsUtil.java

License:Open Source License

/** Initializes a layout with dialog unit settings. 
 * @param testControl the control used to obtain FontMetrics. */
public static void initGridLayoutWithDLUs(GridLayout layout, Control testControl) {

    FontMetrics fontMetrics = getFontMetrics(testControl);

    layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.VERTICAL_SPACING);
    layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
}