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

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);//w  w w.  j av a  2 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));

    createLinkControl(messageComposite);

    int indent = convertWidthInCharsToPixels(3);

    fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent);

    fSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fSortAllRadio.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);
    final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    imageLabel1.setImage(image);
    imageLabel1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    final Label label = new Label(warningComposite, SWT.WRAP);
    label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
    label.setFont(warningComposite.getFont());

    fNotSortAllRadio.setDialogFieldListener(new IDialogFieldListener() {
        @Override
        public void dialogFieldChanged(DialogField field) {
            imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
            label.setEnabled(!fNotSortAllRadio.isSelected());
        }
    });
    imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
    label.setEnabled(!fNotSortAllRadio.isSelected());

    return messageComposite;
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);/*w w w  .j  ava  2s  .  co m*/

    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.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);//  w w w .j av a  2 s . co  m
    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);/*  ww  w  .j av  a  2s .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.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java

License:Open Source License

/**
 * Creates the dialog's title area./*www .  j  a va2  s . com*/
 * 
 * @param parent
 *            the SWT parent for the title area widgets
 * @return Control with the highest x axis value.
 */
private Control createTitleArea(Composite parent) {

    // add a dispose listener
    parent.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            if (titleAreaColor != null) {
                titleAreaColor.dispose();
            }
        }
    });
    // Determine the background color of the title bar
    Display display = parent.getDisplay();
    Color background;
    Color foreground;
    if (titleAreaRGB != null) {
        titleAreaColor = new Color(display, titleAreaRGB);
        background = titleAreaColor;
        foreground = null;
    } else {
        background = JFaceColors.getBannerBackground(display);
        foreground = JFaceColors.getBannerForeground(display);
    }

    parent.setBackground(background);
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    // Dialog image @ right
    titleImageLabel = new Label(parent, SWT.CENTER);
    titleImageLabel.setBackground(background);
    if (titleAreaImage == null)
        titleImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER));
    else
        titleImageLabel.setImage(titleAreaImage);

    FormData imageData = new FormData();
    imageData.top = new FormAttachment(0, 0);
    // Note: do not use horizontalSpacing on the right as that would be a
    // regression from
    // the R2.x style where there was no margin on the right and images are
    // flush to the right
    // hand side. see reopened comments in 41172
    imageData.right = new FormAttachment(100, 0); // horizontalSpacing
    titleImageLabel.setLayoutData(imageData);
    // Title label @ top, left
    titleLabel = new Label(parent, SWT.LEFT);
    JFaceColors.setColors(titleLabel, foreground, background);
    titleLabel.setFont(JFaceResources.getBannerFont());
    titleLabel.setText(" ");//$NON-NLS-1$
    FormData titleData = new FormData();
    titleData.top = new FormAttachment(0, verticalSpacing);
    titleData.right = new FormAttachment(titleImageLabel);
    titleData.left = new FormAttachment(0, horizontalSpacing);
    titleLabel.setLayoutData(titleData);
    // Message image @ bottom, left
    messageImageLabel = new Label(parent, SWT.CENTER);
    messageImageLabel.setBackground(background);
    // Message label @ bottom, center
    messageLabel = new Link(parent, SWT.WRAP | SWT.READ_ONLY);
    JFaceColors.setColors(messageLabel, foreground, background);
    messageLabel.setText(" \n "); // two lines//$NON-NLS-1$
    messageLabel.setFont(JFaceResources.getDialogFont());
    messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    // Filler labels
    leftFillerLabel = new Label(parent, SWT.CENTER);
    leftFillerLabel.setBackground(background);
    bottomFillerLabel = new Label(parent, SWT.CENTER);
    bottomFillerLabel.setBackground(background);
    setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    determineTitleImageLargest();
    if (titleImageLargest)
        return titleImageLabel;
    return messageLabel;
}

From source file:com.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java

License:Open Source License

/**
 * Determine if the title image is larger than the title message and message
 * area. This is used for layout decisions.
 *//*  w  ww  .j a  v a  2 s .c om*/
private void determineTitleImageLargest() {
    int titleY = titleImageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int labelY = titleLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    labelY += verticalSpacing;
    labelY += messageLabelHeight;
    labelY += verticalSpacing;
    titleImageLargest = titleY > labelY;
}

From source file:com.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java

License:Open Source License

/**
 * Re-layout the labels for the new message.
 *//*from www .  ja  v  a2  s  .co  m*/
private void layoutForNewMessage() {
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    // If there are no images then layout as normal
    if (errorMessage == null && messageImage == null) {
        setImageLabelVisible(false);
        setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    } else {
        messageImageLabel.setVisible(true);
        bottomFillerLabel.setVisible(true);
        leftFillerLabel.setVisible(true);
        /**
         * Note that we do not use horizontalSpacing here as when the
         * background of the messages changes there will be gaps between the
         * icon label and the message that are the background color of the
         * shell. We add a leading space elsewhere to compendate for this.
         */
        FormData data = new FormData();
        data.left = new FormAttachment(0, H_GAP_IMAGE);
        data.top = new FormAttachment(titleLabel, verticalSpacing);
        messageImageLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0, SWT.RIGHT);
        bottomFillerLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0);
        leftFillerLabel.setLayoutData(data);
        FormData messageLabelData = new FormData();
        messageLabelData.top = new FormAttachment(titleLabel, verticalSpacing);
        messageLabelData.right = new FormAttachment(titleImageLabel);
        messageLabelData.left = new FormAttachment(messageImageLabel, 0);
        messageLabelData.height = messageLabelHeight;
        if (titleImageLargest)
            messageLabelData.bottom = new FormAttachment(titleImageLabel, 0, SWT.BOTTOM);
        messageLabel.setLayoutData(messageLabelData);
    }
    // Do not layout before the dialog area has been created
    // to avoid incomplete calculations.
    if (dialogArea != null)
        workArea.getParent().layout(true);
}

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  w  w .  ja  va  2  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.//  w w w .java 2s . 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);/*from  w  w  w. ja  va 2 s . c o  m*/
    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;
}