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

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

Introduction

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

Prototype

int VERTICAL_MARGIN

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

Click Source Link

Document

Vertical margin in dialog units (value 7).

Usage

From source file:com.google.dart.tools.ui.internal.dialogs.OpenFolderDialog.java

License:Open Source License

private void createRunPubMessage(Composite parent) {
    Composite panel = 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);
    panel.setLayout(layout);/*w w w  .  j  a  v a  2s  .  c om*/
    panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    panel.setFont(parent.getFont());

    runPubButton = new Button(panel, SWT.CHECK);
    runPubButton.setText(DialogMessages.OpenFolderDialog_rubPubMessage);
    runPubButton.setSelection(true);
}

From source file:com.google.dart.tools.ui.internal.dialogs.OptionalMessageDialog.java

License:Open Source License

@Override
protected Control createCustomArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*ww  w  .  jav a2 s  .c om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    fHideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT);
    fHideDialogCheckBox.setText(CHECKBOX_TEXT);
    fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setDialogEnabled(fId, !((Button) e.widget).getSelection());
        }
    });
    applyDialogFont(fHideDialogCheckBox);
    return fHideDialogCheckBox;
}

From source file:com.google.dart.tools.ui.internal.dialogs.SourceActionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);//from ww w .ja  va2 s .  c om

    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:com.google.dart.tools.ui.internal.preferences.AppearancePreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);/*from  ww w .  ja v  a2  s.c o  m*/
    int nColumns = 1;

    Composite result = new Composite(parent, SWT.NONE);
    result.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.numColumns = nColumns;
    result.setLayout(layout);

    fShowMethodReturnType.doFillIntoGrid(result, nColumns);
    fShowCategory.doFillIntoGrid(result, nColumns);
    fShowColoredLabels.doFillIntoGrid(result, nColumns);

    initFields();

    Dialog.applyDialogFont(result);
    return result;
}

From source file:com.google.dart.tools.ui.internal.text.dart.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.
 *//*ww  w . j  a v a 2 s . co  m*/
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = DartToolsPlugin.getActiveWorkbenchShell();
        String title = DartTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = DartTextMessages.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(
                DartTextMessages.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.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);
            }

            /*
             * @see com.google.dart.tools.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;
            }
        };
        int returnValue = dialog.open();
        if (restoreId == returnValue || settingsId == returnValue) {
            if (restoreId == returnValue) {
                IPreferenceStore store = DartToolsPlugin.getDefault().getPreferenceStore();
                store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue) {
                PreferencesUtil.createPreferenceDialogOn(shell,
                        "com.google.dart.tools.ui.internal.preferences.CodeAssistPreferenceAdvanced", null, //$NON-NLS-1$
                        null).open();
            }
            CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault();
            registry.reload();
            return true;
        }
    }
    return false;
}

From source file:com.google.dart.tools.ui.web.pubspec.PackageSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite 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);/*from   w  w w  . ja  v a  2 s  .  c om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    createMessageArea(composite);
    Text filterText = createFilterText(composite);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            Status status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
                    null);
            if (!getFilter().isEmpty() && !isValidDartIdentifier(getFilter())) {
                status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
                        "Not a valid identifier", null);
            }
            updateStatus(status);
        }
    });

    createFilteredList(composite);

    setListElements(elements);

    setSelection(getInitialElementSelections().toArray());

    return composite;
}

From source file:com.google.devtools.depan.nodes.filters.eclipse.ui.widgets.FilterEditorDialog.java

License:Apache License

private Composite setUpSaveAs(Composite parent) {
    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = Widgets.buildContainerLayout(1);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    result.setLayout(layout);/*from w  w  w.  j  ava  2 s .  co m*/

    Button saveAs = Widgets.buildCompactPushButton(result, "Save As...");
    setButtonLayoutData(saveAs);
    saveAs.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleSaveAs();
        }
    });

    return result;
}

From source file:com.hangum.tadpole.commons.exception.dialog.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite and calls <code>createMessageArea</code> and
 * <code>createCustomArea</code> to populate it. Subclasses should
 * override <code>createCustomArea</code> to add contents below the
 * message./* w ww . j  a v a2  s.  c  o  m*/
 */
protected Control createDialogArea(Composite parent) {
    createMessageArea(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);
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return composite;
}

From source file:com.hangum.tadpole.exception.dialog.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite and calls <code>createMessageArea</code> and
 * <code>createCustomArea</code> to populate it. Subclasses should
 * override <code>createCustomArea</code> to add contents below the
 * message./*ww w  . j  a v  a2 s. c  o m*/
 */
protected Control createDialogArea(Composite parent) {
    createMessageArea(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);
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());
    return composite;
}

From source file:com.ibm.research.tours.dialogs.TimeDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite 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);//  w  w w. j av a  2 s.com
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    fTimeCheckButton = new Button(composite, SWT.CHECK);
    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    fTimeCheckButton.setLayoutData(data);
    fTimeCheckButton.setText(fMessage);
    fTimeCheckButton.setSelection(fIsTimeSet);

    fTimeCheckButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fIsTimeSet = fTimeCheckButton.getSelection();
            fMinuteSpinner.setEnabled(fIsTimeSet);
            fSecondSpinner.setEnabled(fIsTimeSet);
        }

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

    Group timeGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
    GridLayout groupLayout = new GridLayout(4, false);
    timeGroup.setLayout(groupLayout);
    GridData timeGroupData = new GridData(GridData.FILL_BOTH);
    timeGroupData.horizontalSpan = 2;
    timeGroup.setLayoutData(timeGroupData);
    timeGroup.setText("Time Limit");

    Label minuteLabel = new Label(timeGroup, SWT.NONE);
    minuteLabel.setText("Minutes");
    fMinuteSpinner = new Spinner(timeGroup, SWT.BORDER);

    if (fTimeLimit != null)
        fMinuteSpinner.setSelection(fTimeLimit.getMinutes());

    fMinuteSpinner.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (fTimeLimit != null)
                fTimeLimit.setMinutes(fMinuteSpinner.getSelection());
        }
    });

    Label secondLabel = new Label(timeGroup, SWT.NONE);
    secondLabel.setText("Seconds");
    fSecondSpinner = new Spinner(timeGroup, SWT.BORDER);
    fSecondSpinner.setMaximum(60);

    if (fTimeLimit != null)
        fSecondSpinner.setSelection(fTimeLimit.getSeconds());

    fSecondSpinner.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (fTimeLimit != null)
                fTimeLimit.setSeconds(fSecondSpinner.getSelection());
        }
    });

    fMinuteSpinner.setEnabled(fIsTimeSet);
    fSecondSpinner.setEnabled(fIsTimeSet);

    return parent;
}