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.papyrus.diagram.common.dialogs.CustomCheckedTreeSelectionDialog.java

License:Open Source License

/**
 * Adds the selection and deselection buttons to the dialog.
 * //from  ww  w .  ja  va 2  s .co m
 * @param composite
 *        the parent composite
 * @return Composite the composite the buttons were created in.
 */
protected Composite createSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonComposite.setLayout(layout);
    buttonComposite.setFont(composite.getFont());
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
    data.grabExcessHorizontalSpace = true;
    buttonComposite.setLayoutData(data);
    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
            WorkbenchMessages.CheckedTreeSelectionDialog_select_all, false);
    SelectionListener listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Object[] viewerElements = fContentProvider.getElements(fInput);
            if (fContainerMode) {
                fViewer.setCheckedElements(viewerElements);
            } else {
                for (int i = 0; i < viewerElements.length; i++) {
                    fViewer.setSubtreeChecked(viewerElements[i], true);
                }
            }
            updateOKStatus();
        }
    };
    selectButton.addSelectionListener(listener);
    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
            WorkbenchMessages.CheckedTreeSelectionDialog_deselect_all, false);
    listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fViewer.setCheckedElements(new Object[0]);
            updateOKStatus();
        }
    };
    deselectButton.addSelectionListener(listener);
    return buttonComposite;
}

From source file:org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog.java

License:Open Source License

/**
 * {@inheritDoc}/*  ww  w . j a va 2 s .c o m*/
 */
@Override
protected Control createDialogArea(Composite parent) {
    Group composite = new Group(parent, SWT.RESIZE);
    composite.setText("Specification");
    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));

    Composite viewerGroup = new Composite(composite, SWT.RESIZE);
    FillLayout viewerLayout = new FillLayout();
    viewerGroup.setLayout(viewerLayout);
    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);
    viewerGroup.setLayoutData(data);
    viewer = new SourceViewer(viewerGroup, null, SWT.BORDER | SWT.FILL_EVEN_ODD);

    // configure source viewer
    document = new Document();
    document.set(value);

    // add completion processor key listener (ctrl+space keys)
    viewer.appendVerifyKeyListener(new LabelKeyListener(viewer));

    document.addDocumentListener(new DocumentListener());
    viewer.configure(configuration.getSourceViewerConfiguration());
    viewer.setDocument(document);

    Selection selection = configuration.getTextSelection(value, editedObject);
    viewer.setSelectedRange(selection.getStart(), selection.getLentgh());

    Composite extendedArea = configuration.createExtendedDialogArea(viewerGroup);
    if (extendedArea != null) {
        extendedArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    }

    errorMessageText = new CLabel(composite, SWT.READ_ONLY | SWT.SHADOW_NONE);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.papyrus.profile.ui.dialogs.DefinitionHistoryDialog.java

License:Open Source License

/**
 * {@inheritDoc}/* ww w .  j  a  va  2 s . c om*/
 */
@Override
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Profile definition history");
    setTitleImage(ImageManager.getImage(PROFILE_ANNOTATION_IMG));

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout(1, true);
    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(SWT.FILL, SWT.FILL, true, true));
    composite.setFont(parentComposite.getFont());

    // fill composite with information about definitions:
    GridData gd;

    Composite tableArea = createTableArea(composite);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    tableArea.setLayoutData(gd);

    applyDialogFont(parentComposite);
    return parentComposite;
}

From source file:org.eclipse.papyrus.profile.ui.dialogs.ProfileDefinitionDialog.java

License:Open Source License

/**
 * {@inheritDoc}/* www  . j  a  va2 s.com*/
 */
@Override
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Information about new definition");
    setTitleImage(ImageManager.getImage(PROFILE_DEFINITION));

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout(2, true);
    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(SWT.FILL, SWT.FILL, true, true));
    composite.setFont(parentComposite.getFont());

    // compute initial values
    computeVersionValues();

    // fill composite with information about new definition:
    // 1. version
    // 2. author
    // 3. comment
    // 4. date
    // 5. copyright
    GridData gd;

    Composite versionArea = createVersionArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    versionArea.setLayoutData(gd);

    Composite infoArea = createInfoArea(composite);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    infoArea.setLayoutData(gd);

    Composite commentArea = createCommentArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
    commentArea.setLayoutData(gd);

    Composite copyrightArea = createCopyrightArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
    copyrightArea.setLayoutData(gd);

    Composite advancedArea = createAdvancedArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
    advancedArea.setLayoutData(gd);

    applyDialogFont(parentComposite);
    return parentComposite;
}

From source file:org.eclipse.papyrus.properties.tabbed.customization.dialog.CustomizeContentWizardPage.java

License:Open Source License

/**
 * {@inheritDoc}// w  w w  .  ja va 2  s  . co  m
 */
public void createControl(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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    SashForm sashForm = new SashForm(composite, SWT.HORIZONTAL);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createContentExplorer(sashForm);
    createConfigurationArea(sashForm);

    sashForm.setWeights(new int[] { 40, 60 });

    setControl(composite);
}

From source file:org.eclipse.pde.internal.ua.ui.wizards.cheatsheet.NewCategoryNameDialog.java

License:Open Source License

/**
 * @param parent/*  ww  w  . j  a va 2  s .c om*/
 * @return
 */
private Composite createUIContainer(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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    return composite;
}

From source file:org.eclipse.php.formatter.ui.preferences.CreateProfileDialog.java

License:Open Source License

public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    GridData gd;//  www. ja v  a2  s .c o  m

    final GridLayout layout = new GridLayout(numColumns, 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);

    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(layout);

    // Create "Profile name:" label
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    final Label nameLabel = new Label(composite, SWT.WRAP);
    nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text);
    nameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });

    // Create "Initialize settings ..." label
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    Label profileLabel = new Label(composite, SWT.WRAP);
    profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text);
    profileLabel.setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    fProfileCombo.setLayoutData(gd);

    // "Open the edit dialog now" checkbox
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    fEditCheckbox = new Button(composite, SWT.CHECK);
    fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text);
    fEditCheckbox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fOpenEditDialog = ((Button) e.widget).getSelection();
        }

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

    final IDialogSettings dialogSettings = FormatterUIPlugin.getDefault().getDialogSettings();// .get(PREF_OPEN_EDIT_DIALOG);
    if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) {
        fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG);
    } else {
        fOpenEditDialog = true;
    }
    fEditCheckbox.setSelection(fOpenEditDialog);

    fProfileCombo.setItems(fSortedNames);
    fProfileCombo.setText(fProfileManager.getProfile(ProfileManager.DEFAULT_PROFILE).getName());
    updateStatus(fEmpty);

    applyDialogFont(composite);

    fNameText.setFocus();

    return composite;
}

From source file:org.eclipse.php.formatter.ui.preferences.ModifyDialogTabPage.java

License:Open Source License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    group.setFont(parent.getFont());//w  w  w . j a va  2s.  c  om
    group.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT));

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    group.setLayout(layout);
    group.setText(text);
    return group;
}

From source file:org.eclipse.php.formatter.ui.preferences.RenameProfileDialog.java

License:Open Source License

public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    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 = numColumns;//  w ww  . j  a v  a  2s.c om

    final Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(layout);

    // Create "Please enter a new name:" label
    GridData gd = new GridData();
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    fNameLabel = new Label(composite, SWT.NONE);
    fNameLabel.setText(FormatterMessages.RenameProfileDialog_dialog_label_enter_a_new_name);
    fNameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fNameText.setSelection(0, fProfile.getName().length());
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });
    fNameText.setText(fProfile.getName());
    fNameText.selectAll();

    applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.php.internal.debug.ui.launching.ApplicationFileSelectionDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    if (!fAllowExternalFiles) {
        return super.createDialogArea(parent);
    }// ww  w .jav a  2s.  c om
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(font);

    // Attach the regular dialog area
    super.createDialogArea(composite);

    // Attach the checkbox
    fExternalFilesBt = new Button(composite, SWT.CHECK);
    fExternalFilesBt.setText(Messages.ApplicationFileSelectionDialog_0);
    GridData data = new GridData();
    data.grabExcessHorizontalSpace = true;
    data.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    fExternalFilesBt.setLayoutData(data);

    // Add a listener
    fExternalFilesBt.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateView(fExternalFilesBt.getSelection());
        }
    });

    // Set the current state as saved in the preferences.
    String shouldShowExternals = fStore.getString(SHOW_EXTERNAL_FILES);
    if (shouldShowExternals.length() == 0) {
        fExternalFilesBt.setSelection(true);
        updateView(true);
    } else {
        boolean show = Boolean.valueOf(shouldShowExternals).booleanValue();
        fExternalFilesBt.setSelection(show);
        updateView(show);
    }

    return composite;
}