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:aurora.ide.helpers.StatusDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite. Subclasses that require a different dialog area
 * may either override this method, or call the <code>super</code>
 * implementation and add controls to the created composite.
 * /*from   w  ww .  j  ava2s. c  o  m*/
 * Note: Since 3.4, the created composite no longer grabs excess vertical
 * space. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=72489. If the
 * old behavior is desired by subclasses, get the returned composite's
 * layout data and set grabExcessVerticalSpace to true.
 */
protected Control createDialogArea(Composite parent) {
    // Create a composite with standard margins and spacing
    // Add the messageArea to this composite so that as subclasses add
    // widgets to the messageArea
    // and dialogArea, the number of children of parent remains fixed and
    // with consistent layout.
    // Fixes bug #240135
    Composite composite = new Composite(parent, SWT.NONE);
    createMessageArea(composite);
    createSupportArea(parent);
    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;
    childData.grabExcessVerticalSpace = false;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    return composite;
}

From source file:ch.hilbri.assist.application.parts.AboutDialog.java

License:Open Source 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.//w w  w .j a  v  a2  s.  c  om
    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);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(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());

    createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    return composite;
}

From source file:com.amalto.workbench.dialogs.DOMViewDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    try {/*from  ww  w  .  j a  v a2 s.  co  m*/
        // Should not really be here but well,....
        if (editable) {
            parent.getShell().setText(Messages.DOMViewDialog_EditorViewer);
        } else {
            parent.getShell().setText(Messages.DOMViewDialog_Viewer);
        }

        Composite composite = new Composite(parent, SWT.NULL);
        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));
        applyDialogFont(composite);

        if (desc != null && desc.length() > 0) {
            new Label(composite, SWT.NONE).setText(desc);
        }

        tabFolder = new TabFolder(composite, SWT.TOP | SWT.H_SCROLL | SWT.V_SCROLL);
        tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        ((GridData) tabFolder.getLayoutData()).heightHint = 600;
        ((GridData) tabFolder.getLayoutData()).widthHint = 600;

        tabFolder.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
            }

            public void widgetSelected(SelectionEvent e) {
                if (tabFolder.getSelectionIndex() == 0) {
                    if (node == null) {
                        try {

                            if (sourceViewer == null || sourceViewer.getDocument() == null) {
                                return;
                            }
                            node = Util.parse(sourceViewer.getText());

                        } catch (Exception ex) {

                            log.error(ex.getMessage(), ex);
                            tabFolder.setSelection(1);
                            MessageDialog.openError(DOMViewDialog.this.getShell(),
                                    Messages.DOMViewDialog_XMLInvalid, Messages.bind(
                                            Messages.DOMViewDialog_XMLInvalidInfo, ex.getLocalizedMessage()));
                            return;
                        }
                        domViewer.setInput(node);
                        domViewer.expandAll();
                    }
                } else if (tabFolder.getSelectionIndex() == 1) {
                    try {
                        sourceViewer.setText(Util.nodeToString(node));
                        node = null; // this should be better implemented in a change listener on the text
                    } catch (Exception ex) {
                        MessageDialog.openError(DOMViewDialog.this.getShell(),
                                Messages.DOMViewDialog_ErrorTitle,
                                Messages.bind(Messages.DOMViewDialog_ErrorMsg, ex.getLocalizedMessage()));
                        sourceViewer.setText(""); //$NON-NLS-1$
                    }
                }
            }// widget Selected
        });

        TabItem tiDOM = new TabItem(tabFolder, SWT.NULL);
        tiDOM.setText(Messages.DOMViewDialog_Tree);
        tiDOM.setToolTipText(Messages.DOMViewDialog_DisplayAsDomTree);

        domViewer = new TreeViewer(tabFolder, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
        domViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        // ((GridData)domViewer.getControl().getLayoutData()).heightHint=300;
        // ((GridData)domViewer.getControl().getLayoutData()).widthHint=300;
        domViewer.setSorter(null);
        domViewer.setLabelProvider(new DOMTreeLabelProvider());
        domViewer.setContentProvider(new DOMTreeContentProvider());
        domViewer.setInput(node);
        domViewer.expandAll();
        domViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        tiDOM.setControl(domViewer.getControl());

        TabItem tiSource = new TabItem(tabFolder, SWT.NULL);
        tiSource.setText(Messages.DOMViewDialog_TiSourceText);
        tiSource.setToolTipText(Messages.DOMViewDialog_TiSourceTip);

        XMLSourceViewerHelper sourceViewerHelper = XMLSourceViewerHelper.getInstance();
        sourceViewer = new XMLSourceViewer(tabFolder, sourceViewerHelper.createVerticalRuler(),
                sourceViewerHelper.createOverviewRuler(), true, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
        XMLConfiguration sourceViewerConfiguration = new XMLConfiguration(this);
        sourceViewer.configure(sourceViewerConfiguration);
        sourceViewer.initilize();
        sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        sourceViewer.setText(Util.nodeToString(node));
        sourceViewer.setEditable(this.editable);
        /*
         * sourceViewer.addTextListener( new ITextListener() { public void
         * textChanged(org.eclipse.jface.text.TextEvent event) { if ((event.getText()==null) ||
         * ("".equals(event.getText()))) return; node = null; elementChanged = true; } } );
         */
        tiSource.setControl(sourceViewer.getControl());

        tabFolder.setSelection(firstTab);
        if (firstTab == SOURCE_VIEWER) {
            node = null; // force refresh of tree
        }

        return composite;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getShell(), Messages._Error,
                Messages.bind(Messages.DOMViewDialog_ErrorMsg1, e.getLocalizedMessage()));
        return null;
    }

}

From source file:com.amalto.workbench.dialogs.PluginDetailsDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {

    try {/*from  w  w  w  .  j a v  a 2 s  . co m*/
        // Should not really be here but well,....
        parent.getShell().setText(Messages.PluginDetailsDialog_PluginDetails);

        Composite composite = new Composite(parent, SWT.NULL);
        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));
        applyDialogFont(composite);

        tabFolder = new TabFolder(composite, SWT.TOP);
        tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        tabFolder.setLayout(new GridLayout(1, true));
        ((GridData) tabFolder.getLayoutData()).heightHint = 600;
        ((GridData) tabFolder.getLayoutData()).widthHint = 600;

        TabItem descriptionTI = new TabItem(tabFolder, SWT.NULL);
        descriptionTI.setText(Messages.PluginDetailsDialog_Description);
        descriptionTI.setToolTipText(Messages.PluginDetailsDialog_DescriptionTip);

        Composite descriptionC = new Composite(tabFolder, SWT.NULL);
        descriptionC.setLayout(new GridLayout(1, true));
        descriptionC.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

        /*
         * Label descriptionLabel = new Label(descriptionC, SWT.LEFT); descriptionLabel.setLayoutData( new
         * GridData(SWT.LEFT,SWT.CENTER,false,false,1,1) ); FontData fd =
         * descriptionLabel.getFont().getFontData()[0]; fd.setStyle(SWT.BOLD); descriptionLabel.setFont(new
         * Font(Display.getDefault(),fd)); descriptionLabel.setText("Description");
         */

        Label descValue = new Label(descriptionC, SWT.WRAP);
        descValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        descValue.setText(description + "\n");//$NON-NLS-1$

        Label documentationLabel = new Label(descriptionC, SWT.LEFT);
        documentationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
        documentationLabel.setFont(FontUtils.getBoldFont(documentationLabel.getFont()));
        documentationLabel.setText(templetName);

        Text docValue = new Text(descriptionC, SWT.WRAP | SWT.READ_ONLY | SWT.V_SCROLL);
        docValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        docValue.setBackground(documentationLabel.getBackground());
        docValue.setText(documentation);

        descriptionTI.setControl(descriptionC);

        /*
         * TabItem parametersTI = new TabItem(tabFolder,SWT.NULL); parametersTI.setText("Parameters");
         * parametersTI.setToolTipText("Display the plugin description and documentation");
         * 
         * Composite parametersC = new Composite(tabFolder,SWT.NULL); parametersC.setLayout(new GridLayout(1,true));
         * 
         * Label paramsValue = new Label(parametersC, SWT.WRAP); paramsValue.setLayoutData( new
         * GridData(SWT.FILL,SWT.CENTER,true,false,1,1) ); paramsValue.setText(parametersSchema);
         * 
         * parametersTI.setControl(parametersC);
         */

        tabFolder.setSelection(0);

        return composite;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getShell(), Messages._Error,
                Messages.bind(Messages.PluginDetailsDialog_ErrorMsg, e.getLocalizedMessage()));
        return null;
    }

}

From source file:com.amazonaws.eclipse.ec2.ui.securitygroups.EditSecurityGroupPermissionEntryDialog.java

License:Apache License

private Composite createComposite(Composite parent) {
    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    gridLayout.marginHeight = 2;/*w ww  .  j a  v  a 2  s .  co  m*/

    composite.setLayout(gridLayout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    return composite;
}

From source file:com.amazonaws.eclipse.ec2.ui.views.instances.BundleDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            updateOkButton();//w w  w  . jav  a  2  s.  c o m
        }
    };

    this.getShell().setText("Bundle Image");

    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    composite.setLayout(gridLayout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    GridData gridData;

    Label label = new Label(composite, SWT.NONE);
    label.setText("Amazon S3 Bucket:");
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalAlignment = SWT.LEFT;
    gridData.verticalAlignment = SWT.CENTER;
    label.setLayoutData(gridData);

    bucketNameText = new Text(composite, SWT.BORDER);
    bucketNameText.addModifyListener(listener);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 300;
    bucketNameText.setLayoutData(gridData);

    label = new Label(composite, SWT.NONE);
    label.setText("Image Name:");
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalAlignment = SWT.LEFT;
    gridData.verticalAlignment = SWT.CENTER;
    label.setLayoutData(gridData);

    imageNameText = new Text(composite, SWT.BORDER);
    imageNameText.addModifyListener(listener);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 300;
    imageNameText.setLayoutData(gridData);

    applyDialogFont(composite);

    return composite;
}

From source file:com.amazonaws.eclipse.sdk.ui.wizard.NewAwsJavaProjectWizardPageOne.java

License:Open Source License

private GridLayout initGridLayout(GridLayout layout, boolean margins) {
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    if (margins) {
        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {//  w  ww . j ava  2s . com
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}

From source file:com.android.sdkuilib.ApkConfigEditDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout;/*from   ww w.  ja va 2s  .  co  m*/
    composite.setLayout(layout = new GridLayout(2, 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.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label l = new Label(composite, SWT.NONE);
    l.setText("Name");

    mNameField = new Text(composite, SWT.BORDER);
    mNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mNameField.addVerifyListener(this);
    if (mName != null) {
        mNameField.setText(mName);
    }
    mNameField.addModifyListener(this);

    l = new Label(composite, SWT.NONE);
    l.setText("Filter");

    mFilterField = new Text(composite, SWT.BORDER);
    mFilterField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (mFilter != null) {
        mFilterField.setText(mFilter);
    }
    mFilterField.addVerifyListener(this);
    mFilterField.addModifyListener(this);

    applyDialogFont(composite);
    return composite;
}

From source file:com.android.sdkuilib.internal.repository.SdkUpdaterChooserDialog.java

License:Apache License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p/>// w  ww  .j  a  v  a  2 s .c  o  m
 * This reimplements most of the code from the base class with a few exceptions:
 * <ul>
 * <li>Enforces 3 columns.
 * <li>Inserts a full-width error label.
 * <li>Inserts a help label on the left of the first button.
 * <li>Renames the OK button into "Install"
 * </ul>
 */
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    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);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Error message area
    mErrorLabel = new Label(composite, SWT.NONE);
    mErrorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    // Label at the left of the install/cancel buttons
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    label.setText("[*] Something depends on this package");
    label.setEnabled(false);
    layout.numColumns++;

    // Add the ok/cancel to the button bar.
    createButtonsForButtonBar(composite);

    // the ok button should be an "install" button
    Button button = getButton(IDialogConstants.OK_ID);
    button.setText("Install");

    return composite;
}

From source file:com.android.sdkuilib.internal.repository.UpdateChooserDialog.java

License:Apache License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p/>// w  w w  .ja  v  a 2  s  . com
 * This reimplements most of the code from the base class with a few exceptions:
 * <ul>
 * <li>Enforces 3 columns.
 * <li>Inserts a full-width error label.
 * <li>Inserts a help label on the left of the first button.
 * <li>Renames the OK button into "Install"
 * </ul>
 */
@Override
protected Control createButtonBar(Composite parent) {

    Composite composite = new Composite(parent, SWT.NONE);
    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);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Error message area
    mErrorLabel = new Label(composite, SWT.NONE);
    mErrorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    // Label at the left of the install/cancel buttons
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    label.setText("[*] Something depends on this package");
    label.setEnabled(false);
    layout.numColumns++;

    // Add the ok/cancel to the button bar.
    createButtonsForButtonBar(composite);

    // the ok button should be an "install" button
    Button button = getButton(IDialogConstants.OK_ID);
    button.setText("Install");

    return composite;
}