Example usage for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING

List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING.

Prototype

int HORIZONTAL_SPACING

To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING.

Click Source Link

Document

Horizontal spacing in dialog units (value 4).

Usage

From source file:org.eclipse.sirius.common.ui.tools.api.dialog.NewFileDialog.java

License:Open Source License

/**
 * {@inheritDoc}// w  ww  .j a  v  a 2  s.c  o m
 * 
 * @see org.eclipse.sirius.common.ui.tools.api.dialog.FolderSelectionDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 */
@Override
protected Control createDialogArea(final Composite parent) {
    final Control result = super.createDialogArea(parent);
    final Composite composite = new Composite(parent, SWT.NONE);
    final 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));
    final Label label = new Label(composite, SWT.NULL);
    label.setText("File"); //$NON-NLS-1$
    newFileNameText = new Text(composite, SWT.BORDER);
    final GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    data.heightHint = newFileNameText.getLineHeight();
    data.widthHint = newFileNameText.getLineHeight() * 30;
    newFileNameText.setLayoutData(data);
    newFileNameText.setText(newFileName);
    newFileNameText.addModifyListener(new ModifyListener() {
        public void modifyText(final ModifyEvent e) {
            updateOKStatus();
        }
    });
    return result;
}

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

License:Open Source License

/**
 * @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
 *///from w w  w  .j  ava 2s.co m
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));

    addUnaddedResourcesArea(composite);

    return composite;
}

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

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite top = new Composite((Composite) super.createDialogArea(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);
    top.setLayout(layout);/* www  .  ja  v  a2 s .com*/
    top.setLayoutData(new GridData(GridData.FILL_BOTH));

    PlatformUI.getWorkbench().getHelpSystem().setHelp(top, IHelpContextIds.ADD_TO_CVSIGNORE);

    Listener selectionListener = new Listener() {
        public void handleEvent(Event event) {
            updateEnablements();
        }
    };
    Listener modifyListener = new Listener() {
        public void handleEvent(Event event) {
            validate();
        }
    };

    addNameEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addNameEntryButton);
    addNameEntryButton.addListener(SWT.Selection, selectionListener);
    addNameEntryButton.setSelection(selectedAction == ADD_NAME_ENTRY);
    Label addNameEntryLabel = createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addNameEntryExample,
            LABEL_INDENT_WIDTH);

    addExtensionEntryButton = createRadioButton(top,
            CVSUIMessages.IgnoreResourcesDialog_addExtensionEntryButton);
    addExtensionEntryButton.addListener(SWT.Selection, selectionListener);
    addExtensionEntryButton.setSelection(selectedAction == ADD_EXTENSION_ENTRY);
    Label addExtensionEntryLabel = createIndentedLabel(top,
            CVSUIMessages.IgnoreResourcesDialog_addExtensionEntryExample, LABEL_INDENT_WIDTH);

    addCustomEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addCustomEntryButton);
    addCustomEntryButton.addListener(SWT.Selection, selectionListener);
    addCustomEntryButton.setSelection(selectedAction == ADD_CUSTOM_ENTRY);
    createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addCustomEntryExample, LABEL_INDENT_WIDTH);

    if (resourceWithSpaces) {
        customEntryText = createIndentedText(top, getResourceWithSpace().getName().replaceAll(" ", "?"), //$NON-NLS-1$//$NON-NLS-2$
                LABEL_INDENT_WIDTH);
        ControlDecoration customEntryTextDecoration = new ControlDecoration(customEntryText,
                SWT.TOP | SWT.LEAD);
        FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
        FieldDecoration infoDecoration = registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
        customEntryTextDecoration.setImage(infoDecoration.getImage());
        customEntryTextDecoration.setDescriptionText(CVSUIMessages.IgnoreResourcesDialog_filesWithSpaceWarning);
        customEntryTextDecoration.setShowOnlyOnFocus(false);
        GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalIndent = LABEL_INDENT_WIDTH
                + FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
        customEntryText.setLayoutData(gridData);
        customEntryText.setFocus();

        addNameEntryButton.setEnabled(false);
        addNameEntryLabel.setEnabled(false);
        // switch selection to "Custom pattern"
        if (!addCustomEntryButton.getSelection()) {
            addNameEntryButton.setSelection(false);
            addCustomEntryButton.setSelection(true);
            selectedAction = ADD_CUSTOM_ENTRY;
        }

        // when there is at least one resource without extension with spaces 
        // we should disable the "Wildcard extension" option
        if (!allResourcesWithSpacesHaveExtensions) {
            addExtensionEntryButton.setEnabled(false);
            addExtensionEntryLabel.setEnabled(false);
            // switch selection to "Custom pattern" which is always enabled
            addExtensionEntryButton.setSelection(false);
            addCustomEntryButton.setSelection(true);
            selectedAction = ADD_CUSTOM_ENTRY;
        }

    } else {
        customEntryText = createIndentedText(top, resources[0].getName(), LABEL_INDENT_WIDTH);
    }

    customEntryText.addListener(SWT.Modify, modifyListener);

    applyDialogFont(top);

    return top;
}

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);// ww  w. j a  va 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;//from  w  ww.j  ava2s .  co  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.ui.dialogs.DetailsDialog.java

License:Open Source License

final protected Control createDialogArea(Composite parent) {

    applyDialogFont(parent);//  w w w. 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)
 *///w  w  w. j a v a 2 s.c  om
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);/*from   w  w w. jav a2s.co  m*/
    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);//www  .ja  v  a 2s  .co 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   ww  w .ja v  a  2 s  .  co  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();
}