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:org.entirej.applicationframework.tmt.pages.EJTMTScreenPage.java

License:Apache License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size./* ww  w.j a v  a2  s.c o  m*/
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = (IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = (IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = (IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = (IDialogConstants.VERTICAL_SPACING);
    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:org.entirej.applicationframework.tmt.pages.EJTMTScreenPage.java

License:Apache License

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 = (IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = (IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = (IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = (IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);//from  ww w  .j a v  a2 s.  c o m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    createBody(composite);
    return composite;
}

From source file:org.hibernate.eclipse.launch.AddPropertyDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {

    String dialogTitle = HibernateConsoleMessages.AddPropertyDialog_add_exporter_property;
    String editTitle = HibernateConsoleMessages.AddPropertyDialog_add_property_to;
    if (flagEdit) {
        dialogTitle = HibernateConsoleMessages.AddPropertyDialog_edit_exporter_property;
        editTitle = HibernateConsoleMessages.AddPropertyDialog_edit_property_to;
    }/*from ww w.  j  a  v a2  s. c o m*/
    getShell().setText(dialogTitle);
    setTitle(editTitle + ef.getExporterDefinition().getDescription());
    Composite control = (Composite) super.createDialogArea(parent);

    Composite composite = new Composite(control, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);

    Label label = new Label(composite, SWT.NONE);
    label.setText(HibernateConsoleMessages.AddPropertyDialog_name);
    final Combo combo = new Combo(composite, SWT.BORDER | SWT.DROP_DOWN);
    GridData pgd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    pgd.horizontalSpan = 2;
    combo.setLayoutData(pgd);
    combo.setFocus();
    combo.addModifyListener(modifyListener);
    propertyCombo = new ComboViewer(combo);

    combo.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
        }

        public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.ARROW_UP || e.keyCode == SWT.ARROW_DOWN) {
                //linux doesn't call selectionChanged event on this events
                propertyCombo.setSelection(propertyCombo.getSelection(), false);
                return;
            }

            for (int i = 0; i < combo.getItemCount(); i++) {
                if (combo.getText().equals(combo.getItem(i))) {
                    if (combo.getSelectionIndex() != i) {
                        combo.select(i);
                        propertyCombo.setSelection(propertyCombo.getSelection(), false);
                    }
                    return;
                }
            }
            disposeBrowseButton();
            createTextValueComposite(2);
        }

    });

    if (flagEdit) {
        propertyCombo.getControl().setEnabled(false);
    }

    label = new Label(composite, SWT.NONE);
    label.setText(HibernateConsoleMessages.AddPropertyDialog_value);

    value = new Text(composite, SWT.BORDER);
    value.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
    ((Text) value).addModifyListener(modifyListener);

    initDefaultNames(ef, propertyCombo);

    return control;
}

From source file:org.jboss.tools.common.model.ui.dialog.ErrorDialog.java

License:Open Source License

GridLayout createLayout() {
    GridLayout gl = new GridLayout(2, false);
    gl.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gl.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gl.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    gl.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    return gl;/*from   w w w .j  a  v  a  2  s . com*/
}

From source file:org.jboss.tools.jsf.ui.editor.check.wizards.QuickFixPage.java

License:Open Source License

public void createControl(Composite parent) {

    initializeDialogUnits(parent);//ww  w . ja  va  2  s  . c  om

    // Create a new composite as there is the title bar seperator
    // to deal with
    Composite control = new Composite(parent, SWT.NONE);
    control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    setControl(control);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(control, IWorkbenchHelpContextIds.PROBLEMS_VIEW);

    FormLayout layout = new FormLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.spacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    control.setLayout(layout);

    Label resolutionsLabel = new Label(control, SWT.NONE);
    resolutionsLabel.setText(MarkerMessages.MarkerResolutionDialog_Resolutions_List_Title);

    resolutionsLabel.setLayoutData(new FormData());

    createResolutionsList(control);

    FormData listData = new FormData();
    listData.top = new FormAttachment(resolutionsLabel, 0);
    listData.left = new FormAttachment(0);
    listData.right = new FormAttachment(100, 0);
    listData.height = convertHeightInCharsToPixels(10);
    resolutionsList.getControl().setLayoutData(listData);

    Label title = new Label(control, SWT.NONE);
    title.setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Title);
    FormData labelData = new FormData();
    labelData.top = new FormAttachment(resolutionsList.getControl(), 0);
    labelData.left = new FormAttachment(0);
    title.setLayoutData(labelData);

    createMarkerTable(control);

    Composite buttons = createTableButtons(control);
    FormData buttonData = new FormData();
    buttonData.top = new FormAttachment(title, 0);
    buttonData.right = new FormAttachment(100);
    buttonData.height = convertHeightInCharsToPixels(10);
    buttons.setLayoutData(buttonData);

    FormData tableData = new FormData();
    tableData.top = new FormAttachment(buttons, 0, SWT.TOP);
    tableData.left = new FormAttachment(0);
    tableData.bottom = new FormAttachment(100);
    tableData.right = new FormAttachment(buttons, 0);
    tableData.height = convertHeightInCharsToPixels(10);
    markersTable.getControl().setLayoutData(tableData);

    Dialog.applyDialogFont(control);

    resolutionsList.setSelection(new StructuredSelection(resolutionsList.getElementAt(0)));

    markersTable.setAllChecked(true);
}

From source file:org.jboss.tools.jst.css.dialog.ImageSelectionDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from w  ww .  j a  va  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);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    super.applyDialogFont(composite);

    Label messageLabel = createMessageArea(composite);
    new Label(composite, SWT.NONE);

    TreeViewer treeViewer = createTreeViewer(composite);

    Composite comp = createPreview(composite);

    GridData browserData = new GridData(GridData.FILL_BOTH);
    browserData.widthHint = convertWidthInCharsToPixels(fWidth / 2);
    browserData.heightHint = convertHeightInCharsToPixels(fHeight);
    browserData.minimumWidth = convertWidthInCharsToPixels(fWidth / 2);
    browserData.minimumHeight = convertHeightInCharsToPixels(fHeight);
    comp.setLayoutData(browserData);

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

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

    filterCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
    filterCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));

    filterCombo.add(JstUIMessages.ALL_FILES);
    filterCombo.add(JstUIMessages.ALL_IMAGE_FILES);

    for (int i = 0; i < fileExtensions.length; i++) {
        String[] str = fileExtensions[i];
        StringBuffer buf = new StringBuffer();

        for (int j = 0; j < str.length; j++) {
            buf.append("*." + str[j].toUpperCase() + "; "); //$NON-NLS-1$ //$NON-NLS-2$
        }

        filterCombo.add(buf.toString());
    }

    filterCombo.select(0);
    filterCombo.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (fViewer != null) {
                ViewerFilter[] filters = fViewer.getFilters();

                if (filters != null) {
                    for (int i = 0; i < filters.length; i++) {
                        fViewer.removeFilter(filters[i]);
                    }
                }

                if (filterCombo.getSelectionIndex() != 0) {
                    if (filterCombo.getSelectionIndex() == 1) {
                        Set<String> s = new HashSet<String>();

                        for (int i = 0; i < fileExtensions.length; i++) {
                            String[] tmp = fileExtensions[i];

                            for (int j = 0; j < tmp.length; j++)
                                s.add(tmp[j]);
                        }

                        String[] allExtensions = new String[s.size()];
                        s.toArray(allExtensions);
                        fViewer.addFilter(new FileExtensionFilter(allExtensions));
                    } else {
                        fViewer.addFilter(
                                new FileExtensionFilter(fileExtensions[filterCombo.getSelectionIndex() - 2]));
                    }
                }

                fViewer.refresh();

                if (fViewer.getTree().getItemCount() <= 0) {
                    fIsEmpty = true;
                } else {
                    fIsEmpty = false;
                }

                if (fViewer.getTree().getSelectionCount() <= 0) {
                    file = null;
                    canvas.redraw();
                }

                updateOKStatus();
            }
        }
    });

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

    //JBIDE-3084, implementation of default validator
    fValidator = new ISelectionStatusValidator() {
        public IStatus validate(Object[] selection) {
            if ((selection != null) && (selection.length == 1)) {
                Object selecObject = selection[0];

                if (selecObject instanceof IFile) {
                    return Status.OK_STATUS;
                }
            }

            return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
                    JstUIMessages.ImageSelectionDialog_InvalidImageFile, null);
        }
    };

    return composite;
}

From source file:org.jboss.tools.project.examples.dialog.xpl.QuickFixPage.java

License:Open Source License

public void createControl(Composite parent) {

    initializeDialogUnits(parent);/*from www  . j a v a  2  s. com*/

    // Create a new composite as there is the title bar seperator
    // to deal with
    Composite control = new Composite(parent, SWT.NONE);
    control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    setControl(control);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(control, IWorkbenchHelpContextIds.PROBLEMS_VIEW);

    FormLayout layout = new FormLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.spacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    control.setLayout(layout);

    Label resolutionsLabel = new Label(control, SWT.NONE);
    resolutionsLabel.setText(MarkerMessages.MarkerResolutionDialog_Resolutions_List_Title);

    resolutionsLabel.setLayoutData(new FormData());

    createResolutionsList(control);

    FormData listData = new FormData();
    listData.top = new FormAttachment(resolutionsLabel, 0);
    listData.left = new FormAttachment(0);
    listData.right = new FormAttachment(100, 0);
    listData.height = convertHeightInCharsToPixels(10);
    resolutionsList.getControl().setLayoutData(listData);

    Label title = new Label(control, SWT.NONE);
    title.setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Title);
    FormData labelData = new FormData();
    labelData.top = new FormAttachment(resolutionsList.getControl(), 0);
    labelData.left = new FormAttachment(0);
    title.setLayoutData(labelData);

    createMarkerTable(control);

    Composite buttons = createTableButtons(control);
    FormData buttonData = new FormData();
    buttonData.top = new FormAttachment(title, 0);
    buttonData.right = new FormAttachment(100);
    buttonData.height = convertHeightInCharsToPixels(10);
    buttons.setLayoutData(buttonData);

    FormData tableData = new FormData();
    tableData.top = new FormAttachment(buttons, 0, SWT.TOP);
    tableData.left = new FormAttachment(0);
    tableData.bottom = new FormAttachment(100);
    tableData.right = new FormAttachment(buttons, 0);
    tableData.height = convertHeightInCharsToPixels(10);
    markersTable.getControl().setLayoutData(tableData);

    Dialog.applyDialogFont(control);

    if (resolutionsList.getList().getItemCount() > 0) {
        resolutionsList.setSelection(new StructuredSelection(resolutionsList.getElementAt(0)));
    }

    markersTable.setAllChecked(true);
}

From source file:org.jboss.tools.project.examples.preferences.SiteDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);//from w ww  .j a va 2  s  .  c  o m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Composite container = new Composite(parentComposite, SWT.FILL);
    layout = new GridLayout(3, false);
    layout.marginWidth = layout.marginHeight = 5;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    container.setLayoutData(gd);

    Label nameLabel = new Label(container, SWT.NONE);
    nameLabel.setText(Messages.SiteDialog_Name);
    nameText = new Text(container, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    nameText.setLayoutData(gd);
    nameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validatePage();
        }
    });

    Label urlLabel = new Label(container, SWT.NONE);
    urlLabel.setText(Messages.SiteDialog_URL);
    urlText = new Text(container, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    urlText.setLayoutData(gd);
    urlText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validatePage();
        }

    });
    if (selectedSite != null) {
        urlText.setText(selectedSite.getUrl().toString());
        nameText.setText(selectedSite.getName());
    }
    Button browse = new Button(container, SWT.PUSH);
    browse.setText(Messages.Browse);
    browse.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(getShell(), SWT.SINGLE);
            dialog.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$;

            String result = dialog.open();
            if (result == null || result.trim().length() == 0) {
                return;
            }
            try {
                String urlString = new File(result).toURL().toString();
                urlText.setText(urlString);
            } catch (MalformedURLException e1) {
                urlText.setText("file:///" + result); //$NON-NLS-1$
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {

        }
    });

    return parentComposite;
}

From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java

License:Open Source License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p>// ww  w .  j a v a2s .  co m
 * The <code>Dialog</code> implementation of this framework method lays out a button bar and calls the
 * <code>createButtonsForButtonBar</code> framework method to populate it. Subclasses may override.
 * </p>
 * <p>
 * The returned control's layout data must be an instance of <code>GridData</code>.
 * </p>
 *
 * @param parent
 *          the parent composite to contain the button bar
 * @return the button bar control
 */
protected Control createButtonBar(final Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font
    // size.
    final GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = false;
    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);

    final 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:org.locationtech.udig.style.sld.editor.StyleEditorDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    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);//from   ww  w .  j a v  a2  s.co m
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // add import/export buttons
    addImportExportButtons(composite);

    // add apply/revert/close buttons
    addOkCancelRevertApplyButtons(parent, composite);

    return composite;
}