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.koneki.ldt.debug.ui.internal.interpreters.AddLuaInterpreterDialog.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite parent) {

    Composite container = new Composite(parent, SWT.NONE);
    Point margin = new Point(0, 0);
    margin.x = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    margin.y = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    Point spacing = new Point(0, 0);
    spacing.x = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    spacing.y = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    GridLayoutFactory.swtDefaults().spacing(spacing).margins(margin).numColumns(3).applyTo(container);
    GridDataFactory.swtDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(container);

    createLabel(container, InterpretersMessages.addInterpreterDialog_InterpreterEnvironmentType);
    typesCombo = new ComboViewer(container);
    GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).span(2, 1)
            .applyTo(typesCombo.getControl());

    createLabel(container, InterpretersMessages.addInterpreterDialog_InterpreterExecutableName);
    pathText = new Text(container, SWT.SINGLE | SWT.BORDER);
    GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).hint(300, SWT.DEFAULT)
            .applyTo(pathText);//from  ww w  . ja  v a  2  s. c o m
    browseButton = new Button(container, SWT.PUSH);
    browseButton.setText(InterpretersMessages.addInterpreterDialog_browse1);
    GridDataFactory.swtDefaults().hint(SWTUtil.getButtonWidthHint(browseButton), -1).applyTo(browseButton);

    createLabel(container, InterpretersMessages.addInterpreterDialog_InterpreterEnvironmentName);
    nameText = new Text(container, SWT.SINGLE | SWT.BORDER);
    GridDataFactory.swtDefaults().grab(true, false).span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(nameText);

    createLabel(container, InterpretersMessages.AddInterpreterDialog_iArgs);
    argsText = new Text(container, SWT.SINGLE | SWT.BORDER);
    GridDataFactory.swtDefaults().grab(true, false).span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(argsText);

    environementVariableBlock = new LuaInterpreterEnvironmentVariablesBlock(new AddInterpreterDialogAdapter(
            requestor, getShell(), interpreterInstallTypes, currentInterperter));
    final Composite environmentComposite = (Composite) environementVariableBlock.createControl(container);
    GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(2).applyTo(environmentComposite);
    GridDataFactory.swtDefaults().grab(true, true).span(3, 1).align(SWT.FILL, SWT.FILL)
            .applyTo(environmentComposite);

    // Interpreter Capabilities
    capabilitiesGroup = new Group(container, SWT.None);
    capabilitiesGroup.setText(Messages.AddLuaInterpreterDialog_CapabilitesGroupLabel);
    GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(1).applyTo(capabilitiesGroup);
    GridDataFactory.swtDefaults().grab(true, false).span(3, 1).align(SWT.FILL, SWT.FILL)
            .applyTo(capabilitiesGroup);

    capabilitiesDesctiptionLabel = new Label(capabilitiesGroup, SWT.NONE);
    toItalic(capabilitiesDesctiptionLabel);
    GridDataFactory.swtDefaults().span(3, 1).grab(true, false).align(SWT.FILL, SWT.FILL)
            .applyTo(capabilitiesDesctiptionLabel);

    handlesExecutionOption = new Button(capabilitiesGroup, SWT.CHECK);
    handlesExecutionOption.setText(Messages.AddLuaInterpreterDialog_ExecutionOption);

    handlesFilesAsArguments = new Button(capabilitiesGroup, SWT.CHECK);
    handlesFilesAsArguments.setText(Messages.AddLuaInterpreterDialog_FilesAsArguments);

    applyDialogFont(container);
    hookListeners();
    init();

    return container;
}

From source file:org.eclipse.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;//w w w  .j ava  2  s  .com
    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, Messages.LaunchConfigurationEditDialog_0, false);
    createButton(leftButtonComp, DUPLICATE_ID, Messages.LaunchConfigurationEditDialog_1, false);
    // launch button text same as in eclipse LaunchConfigurationDialog - mode name
    createButton(leftButtonComp, LAUNCH_ID, getLaunchButtonText(), 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;
}

From source file:org.eclipse.libra.framework.ui.internal.TerminationDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part 
 * of this dialog (above the button bar).
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control/*from  w w  w . j av a  2s.c o  m*/
 */
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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
            ContextIds.FRAMEWORK_INSTANCE_CLEAN_WORK_DIR_TERMINATE);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(message);
    GridData data = new GridData();
    data.widthHint = 400;
    label.setLayoutData(data);

    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.m2e.core.ui.internal.dialogs.MavenGoalSelectionDialog.java

License:Open Source License

protected Control createDialogArea(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.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);//from  ww  w . j  a v a2  s  .  c  om
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label selectGoalLabel = new Label(composite, SWT.NONE);
    selectGoalLabel.setText(org.eclipse.m2e.core.ui.internal.Messages.MavenGoalSelectionDialog_lblSelect);

    final GoalsFilter filter = new GoalsFilter();

    final Text filterText = new Text(composite, SWT.BORDER);
    GridData gd_filterText = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_filterText.widthHint = 200;
    filterText.setLayoutData(gd_filterText);
    filterText.setFocus();

    final TreeViewer treeViewer = createTreeViewer(composite);
    treeViewer.addFilter(filter);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 500;
    data.heightHint = 400;
    // data.widthHint = convertWidthInCharsToPixels(fWidth);
    // data.heightHint = convertHeightInCharsToPixels(fHeight);

    final Tree tree = treeViewer.getTree();
    tree.setLayoutData(data);
    tree.setFont(parent.getFont());

    filterText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String text = filterText.getText();
            filter.setFilter(text);
            treeViewer.refresh();
            if (text.trim().length() == 0) {
                treeViewer.collapseAll();
            } else {
                treeViewer.expandAll();
            }
        }
    });

    filterText.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.ARROW_DOWN) {
                tree.setFocus();
                tree.setSelection(tree.getTopItem().getItem(0));

                Object[] elements = ((ITreeContentProvider) treeViewer.getContentProvider()).getElements(null);
                treeViewer.setSelection(new StructuredSelection(elements[0]));
            }

        }
    });

    isQualifiedNameButton = new Button(composite, SWT.CHECK);
    isQualifiedNameButton
            .setText(org.eclipse.m2e.core.ui.internal.Messages.MavenGoalSelectionDialog_btnQualified);
    isQualifiedNameButton.setSelection(true);
    isQualifiedNameButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            isQualifiedName = isQualifiedNameButton.getSelection();
        }
    });

    //    if (fIsEmpty) {
    //        messageLabel.setEnabled(false);
    //        treeWidget.setEnabled(false);
    //    }

    return composite;
}

From source file:org.eclipse.m2e.core.ui.internal.preferences.RemoteArchetypeCatalogDialog.java

License:Open Source License

protected Control createButtonBar(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.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*from   w ww  .  j a v a2  s. c o  m*/
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    composite.setFont(parent.getFont());

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

    verifyButton = createButton(composite, VERIFY_ID, Messages.RemoteArchetypeCatalogDialog_btnVerify, false);
    verifyButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            verifyButton.setEnabled(false);
            String url = catalogUrlCombo.getText();
            final RemoteCatalogFactory factory = new RemoteCatalogFactory(url, null, true);

            new Job(Messages.RemoteArchetypeCatalogDialog_job_download) {
                protected IStatus run(IProgressMonitor monitor) {
                    IStatus status = Status.OK_STATUS;
                    ArchetypeCatalog catalog = null;
                    try {
                        catalog = factory.getArchetypeCatalog();
                    } finally {
                        final IStatus s = status;
                        @SuppressWarnings("unchecked")
                        final List<Archetype> archetypes = catalog == null ? Collections.emptyList()
                                : catalog.getArchetypes();
                        getShell().getDisplay().asyncExec(new Runnable() {
                            public void run() {
                                verifyButton.setEnabled(true);
                                if (!s.isOK()) {
                                    setErrorMessage(NLS.bind(Messages.RemoteArchetypeCatalogDialog_error_read,
                                            s.getMessage()));
                                    getButton(IDialogConstants.OK_ID).setEnabled(false);
                                } else if (archetypes.size() == 0) {
                                    setMessage(Messages.RemoteArchetypeCatalogDialog_error_empty,
                                            IStatus.WARNING);
                                } else {
                                    setMessage(NLS.bind(Messages.RemoteArchetypeCatalogDialog_message_found,
                                            archetypes.size()), IStatus.INFO);
                                }
                            }
                        });
                    }
                    return Status.OK_STATUS;
                }
            }.schedule();
        }
    });

    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    layout.numColumns++;

    super.createButtonsForButtonBar(composite); // cancel button

    return composite;
}

From source file:org.eclipse.m2m.atl.adt.ui.preferences.ModifyDialogTabPage.java

License:Open Source License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    group.setFont(parent.getFont());//from w ww.ja v  a2 s  . co m
    group.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT));

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

    // layout.marginHeight= fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    // layout.marginWidth=
    // fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);

    group.setLayout(layout);// createGridLayout(numColumns, true));
    group.setText(text);
    return group;
}

From source file:org.eclipse.mylyn.commons.ui.dialogs.EnhancedWizardDialog.java

License:Open Source License

/**
 * Overridden so we can add a validate button to the wizard button bar, if a repository settings page requires it.
 * Validate button is added left justified at button bar bottom (next to help image).
 *//*from  w ww .j  ava2  s  .co m*/
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // create 
    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_HORIZONTAL));

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

    createExtraButtons(composite);
    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    ((GridLayout) composite.getLayout()).numColumns++;

    super.createButtonsForButtonBar(composite);

    return composite;
}

From source file:org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.ValidatableWizardDialog.java

License:Open Source License

/**
 * Overridden so we can add a validate button to the wizard button bar, if a repository settings page requires it.
 * Validate button is added left justified at button bar bottom (next to help image).
 *//*from  w ww  .j  a va  2 s .  c o  m*/
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // create 
    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_HORIZONTAL));

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

    validateServerButton = createButton(composite, VALIDATE_BUTTON_ID,
            Messages.ValidatableWizardDialog_Validate_Button_Label, false);
    validateServerButton.setImage(CommonImages.getImage(CommonImages.VALIDATE));
    validateServerButton.setVisible(false);
    setButtonLayoutData(validateServerButton);
    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    ((GridLayout) composite.getLayout()).numColumns++;

    super.createButtonsForButtonBar(composite);

    return composite;
}

From source file:org.eclipse.mylyn.internal.tasks.ui.actions.TaskSelectionDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // create 
    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.j a v a 2s  .  c  om*/
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // create help control if needed
    if (isHelpAvailable()) {
        createHelpControl(composite);
    }
    if (needsCreateTask) {
        createTaskButton = createButton(composite, CREATE_ID, Messages.TaskSelectionDialog_New_Task_, true);
        createTaskButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
                // ignore
            }

            public void widgetSelected(SelectionEvent e) {
                close();
                new NewTaskAction().run();
            }
        });
    }

    createAdditionalButtons(composite);

    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    layout.numColumns++;
    super.createButtonsForButtonBar(composite); // cancel button      

    return composite;
}

From source file:org.eclipse.mylyn.internal.tasks.ui.dialogs.AbstractWorkingSetDialogCOPY.java

License:Open Source License

/**
 * Adds the modify buttons to the dialog.
 * /*from www  .  ja v  a  2s .  c o m*/
 * @param composite
 *            Composite to add the buttons to
 */
protected void addModifyButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    GridLayout layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    buttonComposite.setLayout(layout);
    GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_VERTICAL);
    buttonComposite.setLayoutData(data);

    newButton = createButton(buttonComposite, ID_NEW,
            WorkbenchMessages.WorkingSetSelectionDialog_newButton_label, false);
    newButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            createWorkingSet();
        }
    });

    if (canEdit) {
        detailsButton = createButton(buttonComposite, ID_DETAILS,
                WorkbenchMessages.WorkingSetSelectionDialog_detailsButton_label, false);
        detailsButton.setEnabled(false);
        detailsButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                editSelectedWorkingSet();
            }
        });

        removeButton = createButton(buttonComposite, ID_REMOVE,
                WorkbenchMessages.WorkingSetSelectionDialog_removeButton_label, false);
        removeButton.setEnabled(false);
        removeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                removeSelectedWorkingSets();
            }
        });
    }

    layout.numColumns = 1; // must manually reset the number of columns because createButton increments it - we want these buttons to be laid out vertically.
}