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.team.internal.ccvs.ui.subscriber.CommitSetDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    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);/*w  w w  . j a v a 2  s  .  c om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    if (hasCommitTemplate()) {
        if (set.hasComment()) {
            // Only set the comment if the set has a custom comment.
            // Otherwise, the template should be used
            comment = set.getComment();
            commitCommentArea.setProposedComment(comment);
        }
    } else {
        comment = set.getComment();
        commitCommentArea.setProposedComment(comment);
    }

    commitCommentArea.createArea(composite);
    commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty() == CommitCommentArea.OK_REQUESTED) {
                okPressed();
            } else if (event.getProperty() == CommitCommentArea.COMMENT_MODIFIED) {
                comment = (String) event.getNewValue();
                if (!customTitleButton.getSelection()) {
                    nameText.setText(commitCommentArea.getFirstLineOfComment());
                }
                updateEnablements();
            }
        }
    });

    createOptionsArea(composite);
    createNameArea(composite);

    initializeValues();
    updateEnablements();

    Dialog.applyDialogFont(parent);
    return composite;
}

From source file:org.eclipse.team.internal.ccvs.ui.subscriber.CommitSetDialog.java

License:Open Source License

private void createNameArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;//  w w  w . j a va 2s .  c  o  m
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(parent.getFont());

    Label label = new Label(composite, SWT.NONE);
    label.setText(CVSUIMessages.CommitSetDialog_0);
    label.setLayoutData(new GridData(GridData.BEGINNING));

    nameText = new Text(composite, SWT.BORDER);
    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    nameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            customTitle = nameText.getText();
            updateEnablements();
        }
    });
}

From source file:org.eclipse.team.internal.ccvs.ui.wizards.CommitWizardCommitPage.java

License:Open Source License

private void createPlaceholder(final Composite composite) {
    final Composite placeholder = new Composite(composite, SWT.NONE);
    placeholder.setLayoutData(/*from w w w  . j a  v a  2  s  . c o  m*/
            new GridData(SWT.DEFAULT, convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_SPACING) / 3));
}

From source file:org.eclipse.team.internal.ui.dialogs.DetailsDialog.java

License:Open Source License

final protected Control createDialogArea(Composite parent) {

    applyDialogFont(parent);//from www .  j a v  a 2 s  .c  o  m
    initializeDialogUnits(parent);

    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    if (!isMainGrabVertical()) {
        composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    }

    String helpContextId = getHelpContextId();
    if (helpContextId != null) {
        PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, helpContextId);
    }

    // create image
    String key = getImageKey();
    Image image = null;
    if (key != null) {
        image = JFaceResources.getImageRegistry().get(key);
    }
    if (image != null) {
        // create a composite to split the dialog area in two
        Composite top = new Composite(composite, SWT.NONE);
        GridLayout layout = new GridLayout();
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.verticalSpacing = 0;
        layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        layout.numColumns = 2;
        top.setLayout(layout);
        top.setLayoutData(new GridData(GridData.FILL_BOTH));

        // add the image to the left of the composite
        Label label = new Label(top, 0);
        image.setBackground(label.getBackground());
        label.setImage(image);
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));

        // add a composite to the right to contain the custom components
        Composite right = new Composite(top, SWT.NONE);
        layout = new GridLayout();
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
        layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        right.setLayout(layout);
        right.setLayoutData(new GridData(GridData.FILL_BOTH));
        createMainDialogArea(right);
    } else {
        createMainDialogArea(composite);
    }

    if (includeErrorMessage()) {
        errorMessageLabel = new Label(composite, SWT.NONE);
        errorMessageLabel
                .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
        errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
    }

    Dialog.applyDialogFont(parent);
    return composite;
}

From source file:org.eclipse.team.internal.ui.dialogs.DetailsDialogWithProjects.java

License:Open Source License

/**
 * @see DetailsDialog#createDropDownDialogArea(Composite)
 *///from www  .j  a v  a 2s  . com
protected Composite createDropDownDialogArea(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));

    if (detailsTitle != null) {
        Label title = new Label(composite, SWT.WRAP);
        title.setText(detailsTitle);
        title.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    }

    detailsList = new org.eclipse.swt.widgets.List(composite,
            SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.heightHint = convertHeightInCharsToPixels(5);
    detailsList.setLayoutData(data);

    for (int i = 0; i < projects.length; i++) {
        detailsList.add(projects[i].getName());
    }
    return composite;
}

From source file:org.eclipse.team.internal.ui.dialogs.NoChangesDialog.java

License:Open Source License

protected Composite createDropDownDialogArea(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);//w w  w  .  java 2  s .c om
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    selectedMappingsArea = ResourceMappingHierarchyArea.create(scope, null /* no context */);
    selectedMappingsArea.setDescription(description);
    selectedMappingsArea.createArea(composite);
    return composite;
}

From source file:org.eclipse.team.internal.ui.mapping.FuzzFactorDialog.java

License:Open Source License

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

    Label label = new Label(composite, SWT.WRAP);
    label.setText(TeamUIMessages.FuzzFactorDialog_message);
    GridData data = new GridData();
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    label.setFont(parent.getFont());

    valueText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    valueText.setLayoutData(data);
    valueText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    fuzzFactor = patcher.getFuzz();
    if (fuzzFactor >= 0)
        valueText.setText(new Integer(fuzzFactor).toString());

    Button guessButton = new Button(composite, SWT.NONE);
    guessButton.setText(TeamUIMessages.FuzzFactorDialog_guess);
    data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    Point minSize = guessButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    data.widthHint = Math.max(widthHint, minSize.x);
    guessButton.setLayoutData(data);
    guessButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            patcher.setFuzz(-1);
            int fuzz = guessFuzzFactor();
            if (fuzz >= 0) {
                String value = new Integer(fuzz).toString();
                valueText.setText(value);
            }
        }
    });

    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    validateInput();

    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.team.internal.ui.synchronize.ConfigureSynchronizeScheduleComposite.java

License:Open Source License

protected void createMainDialogArea(Composite parent) {
    GC gc = new GC(parent);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();/*from   w w  w  .j  ava 2s .  c o  m*/
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.HORIZONTAL_SPACING);
    gridLayout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics,
            IDialogConstants.VERTICAL_SPACING);
    setLayout(gridLayout);
    setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    Composite area = this;

    createWrappingLabel(area,
            NLS.bind(TeamUIMessages.ConfigureRefreshScheduleDialog_1, new String[] {
                    Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, schedule.getParticipant().getName()) }),
            0, 3);

    enableBackgroundRefresh = new Button(area, SWT.CHECK);
    GridData gridData = new GridData();
    gridData.horizontalSpan = 3;
    enableBackgroundRefresh.setLayoutData(gridData);
    enableBackgroundRefresh.setText(TeamUIMessages.ConfigureRefreshScheduleDialog_3);
    enableBackgroundRefresh.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            updateEnablements();
        }

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

    synchronizeAt = createIndentedLabel(area, TeamUIMessages.ConfigureRefreshScheduleDialog_3a, 20);

    startTime = new DateTime(area, SWT.TIME | SWT.BORDER);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    startTime.setLayoutData(gridData);

    repeatEvery = createIndentedButton(area, TeamUIMessages.ConfigureRefreshScheduleDialog_4, 20);
    repeatEvery.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            updateEnablements();
        }

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

    timeInterval = new Text(area, SWT.BORDER | SWT.RIGHT);
    gridData = new GridData();
    gridData.widthHint = 35;
    timeInterval.setLayoutData(gridData);
    timeInterval.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            updateEnablements();
        }
    });
    timeInterval.addVerifyListener(new VerifyListener() {
        public void verifyText(VerifyEvent e) {
            String string = e.text;
            char[] chars = new char[string.length()];
            string.getChars(0, chars.length, chars, 0);
            for (int i = 0; i < chars.length; i++) {
                if (!('0' <= chars[i] && chars[i] <= '9')) {
                    e.doit = false;
                    return;
                }
            }
        }
    });

    hoursOrMinutes = new Combo(area, SWT.READ_ONLY);
    hoursOrMinutes.setItems(new String[] { TeamUIMessages.ConfigureRefreshScheduleDialog_5,
            TeamUIMessages.ConfigureRefreshScheduleDialog_6 }); // 
    hoursOrMinutes.setLayoutData(new GridData());

    final Label label = new Label(area, SWT.WRAP);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    label.setText(NLS.bind(TeamUIMessages.ConfigureRefreshScheduleDialog_2,
            new String[] { SubscriberRefreshSchedule.refreshEventAsString(schedule.getLastRefreshEvent()) }));

    initializeValues();
    updateEnablements();
}

From source file:org.eclipse.team.svn.ui.dialog.AdvancedDialog.java

License:Open Source License

protected Control createExtendedButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.//from ww w .j  a  v  a  2  s. c  o m
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    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);
    data.horizontalSpan = 2;
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    // Add the buttons to the left button bar.
    this.createButtonsForExtendedButtonBar(composite);
    return composite;
}

From source file:org.eclipse.tm.te.ui.forms.CustomFormToolkit.java

License:Open Source License

/**
 * Creates an expandable section within the given parent scrollable form using the given title.
 * If <code>overwriteBackground</code> is set, the parent background color and background image
 * is applied to the created section./*  www. j  a  v  a2 s .com*/
 *
 * @param parent The parent scrolled form. Must not be <code>null</code>.
 * @param title The expandable composite title. Must not be <code>null</code>.
 * @param entriesToShow The number of entries to show within the expanded area. Must be greater than 0.
 * @param expanded The initial expanded state of the section.
 * @param overwriteBackground If <code>true</code>, the parent background color and image are applied to the section.
 *
 * @return The section.
 */
public final Section createSection(final ScrolledForm scrolledForm, String title, final int entriesToShow,
        boolean expanded, boolean overwriteBackground) {
    Assert.isNotNull(scrolledForm);
    Assert.isNotNull(title);
    Assert.isTrue(entriesToShow > 0);

    // Create the section within the scrollable container
    final Section section = getFormToolkit().createSection(scrolledForm.getBody(),
            ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    section.setText(title);

    // Overwrite background color and image if requested
    if (overwriteBackground) {
        section.setBackground(scrolledForm.getBackground());
        section.setBackgroundImage(scrolledForm.getBackgroundImage());
    }

    section.setLayout(new GridLayout());
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create an associate an expansion listener to the expandable form
    section.addExpansionListener(new IExpansionListener() {
        boolean notExpanded = true;

        /* (non-Javadoc)
         * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanged(org.eclipse.ui.forms.events.ExpansionEvent)
         */
        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            // Always set the scrolled form to re-flow. Otherwise it wouldn't
            // re-arrange the controls following this expandable composite on
            // collapse.
            scrolledForm.reflow(true);

            // Get the shell from the scrolled form.
            Shell shell = scrolledForm.getShell();
            if (shell != null && !shell.isDisposed() && e.getState() && notExpanded) {
                // And recalculate the bounds on expand
                shell.setRedraw(false);
                Rectangle shellBounds = shell.getBounds();

                // Assume at minimum 4 controls within the expandable area.
                shellBounds.height += convertHeightInCharsToPixels(section, Math.max(4, entriesToShow))
                        + IDialogConstants.VERTICAL_SPACING;

                shell.setBounds(shellBounds);
                shell.setRedraw(true);
                notExpanded = false;
            }
        }

        /* (non-Javadoc)
         * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanging(org.eclipse.ui.forms.events.ExpansionEvent)
         */
        @Override
        public void expansionStateChanging(ExpansionEvent e) {
        }
    });

    // Create the client area the caller can use as parent for the control
    Composite client = getFormToolkit().createComposite(section);
    client.setLayout(new GridLayout());

    // Overwrite background color and image if requested
    if (overwriteBackground) {
        client.setBackground(scrolledForm.getBackground());
        client.setBackgroundImage(scrolledForm.getBackgroundImage());
    }

    // Set the initial expansion state
    section.setExpanded(expanded);
    // And associated the client
    section.setClient(client);

    return section;
}