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

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

Introduction

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

Prototype

int HORIZONTAL_MARGIN

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

Click Source Link

Document

Horizontal margin in dialog units (value 7).

Usage

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

License:Open Source License

/**
 * {@inheritDoc}/*ww  w  .  j a  v  a  2 s . com*/
 */
@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  .  ja va2s . c o m
 */
@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}//from   w  ww.  ja  va2  s. c  om
 */
@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 ww. j  a va2s  .c om
 */
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//from  w  ww  . j  a  v  a 2  s . c  o  m
 * @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;//from   w  w w  . j  ava 2 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.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 w  w. j  a  va2s  . 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);
    }/*  www  .j  a  v  a  2s.c o m*/
    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;
}

From source file:org.eclipse.php.internal.ui.dialogs.saveFiles.SaveAsDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // top level composite
    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);/*from  ww  w  .  jav  a  2  s  . co  m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Listener listener = new Listener() {
        public void handleEvent(Event event) {
            setDialogComplete(validatePage());
        }
    };

    resourceGroup = new ResourceAndContainerGroup(composite, listener, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
    resourceGroup.setAllowExistingResources(true);

    return parentComposite;
}

From source file:org.eclipse.php.internal.ui.preferences.EditTemplateDialog.java

License:Open Source License

protected Control createDialogArea(Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//  ww w .  ja  va 2 s  .c  om
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    parent.setLayout(layout);
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));

    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doTextWidgetChanged(e.widget);
        }
    };

    if (fIsNameModifiable) {
        createLabel(parent, PreferencesMessages.EditTemplateDialog_name);

        Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        layout = new GridLayout();
        layout.numColumns = 4;
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        composite.setLayout(layout);

        fNameText = createText(composite);
        fNameText.addFocusListener(new FocusListener() {

            public void focusGained(FocusEvent e) {
            }

            public void focusLost(FocusEvent e) {
                if (fSuppressError) {
                    fSuppressError = false;
                    updateStatusAndButtons();
                }
            }
        });

        createLabel(composite, PreferencesMessages.EditTemplateDialog_context);
        fContextCombo = new Combo(composite, SWT.READ_ONLY);

        for (int i = 0; i < fContextTypes.length; i++) {
            fContextCombo.add(fContextTypes[i][1]);
        }

        fContextCombo.addModifyListener(listener);

        fAutoInsertCheckbox = createCheckbox(composite, PreferencesMessages.EditTemplateDialog_autoinsert);
        fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable());
    }

    createLabel(parent, PreferencesMessages.EditTemplateDialog_description);

    int descFlags = fIsNameModifiable ? SWT.BORDER : SWT.BORDER | SWT.READ_ONLY;
    fDescriptionText = new Text(parent, descFlags);
    fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fDescriptionText.addModifyListener(listener);

    Label patternLabel = createLabel(parent, PreferencesMessages.EditTemplateDialog_pattern);
    patternLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    fPatternEditor = createEditor(parent);

    Label filler = new Label(parent, SWT.NONE);
    filler.setLayoutData(new GridData());

    Composite composite = new Composite(parent, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData());

    fInsertVariableButton = new Button(composite, SWT.NONE);
    fInsertVariableButton.setLayoutData(getButtonGridData());
    fInsertVariableButton.setText(PreferencesMessages.EditTemplateDialog_insert_variable);
    fInsertVariableButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fPatternEditor.getTextWidget().setFocus();
            fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
        }

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

    fDescriptionText.setText(fTemplate.getDescription());
    if (fIsNameModifiable) {
        fNameText.setText(fTemplate.getName());
        fNameText.addModifyListener(listener);
        fContextCombo.select(getIndex(fTemplate.getContextTypeId()));
    } else {
        fPatternEditor.getControl().setFocus();
    }
    initializeActions();

    applyDialogFont(parent);
    return composite;
}