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.obeonetwork.dsl.uml2.design.internal.dialogs.ProfileVersionDialog.java

License:Open Source License

/**
 * {@inheritDoc}//ww  w  .  j a v a  2  s.  c  o  m
 */
@Override
protected Control createDialogArea(final Composite parent) {

    // top level composite.
    final Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Information about profile versioning"); //$NON-NLS-1$

    // create a composite with standard margins and spacing.
    final Composite composite = new Composite(parentComposite, SWT.NONE);
    final 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 for Profile version information
    computeVersionValues();

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

    GridData gd;

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

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

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

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

    applyDialogFont(parentComposite);
    return parentComposite;
}

From source file:org.obeonetwork.dsl.uml2.profile.design.dialogs.ImportMetaclassDialog.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite parent) {

    compositeHeaderMessage = new Composite(parent, SWT.NONE);

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

    compositeHeaderMessage.setLayout(layout);
    Label headerMessage = new Label(compositeHeaderMessage, SWT.NONE);

    headerMessage.setText(headerMessageText);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.horizontalSpan = 2;/*w  w  w.jav  a 2 s.co  m*/
    headerMessage.setLayoutData(gridData);

    final Control dialogArea = super.createDialogArea(parent);
    dialogArea.setEnabled(true);
    parent.getParent().getShell().setMinimumSize(600, 700);
    applyFilter();
    this.setDetailsLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            String text = new String();
            if (element instanceof Class) {
                Class myClass = (Class) element;
                for (Comment comment : myClass.getOwnedComments()) {
                    if (text.isEmpty())
                        text = text + comment.getBody();
                    else
                        text = text + " " + comment.getBody();
                }
            }
            return text;
        }
    });
    return dialogArea;
}

From source file:org.obeonetwork.dsl.uml2.profile.design.dialogs.InitProfilePluginDialog.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite parent) {

    final Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Information about profile versioning");

    // create a composite with standard margins and spacing.
    final Composite composite = new Composite(parentComposite, SWT.NONE);
    final 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);/*  www .j a va  2 s.c o m*/
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    composite.setFont(parentComposite.getFont());

    GridData gd;
    final Composite commentArea = createExportArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
    commentArea.setLayoutData(gd);

    applyDialogFont(parentComposite);
    return parentComposite;
}

From source file:org.obeonetwork.dsl.uml2.profile.design.dialogs.ProfileVersionDialog.java

License:Open Source License

/**
 * {@inheritDoc}/*from w w  w.  ja v a 2s . c  om*/
 */
@Override
protected Control createDialogArea(final Composite parent) {

    // top level composite.
    final Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Information about profile versioning");

    // create a composite with standard margins and spacing.
    final Composite composite = new Composite(parentComposite, SWT.NONE);
    final 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 for Profile version information
    computeVersionValues();

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

    GridData gd;

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

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

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

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

    applyDialogFont(parentComposite);
    return parentComposite;
}

From source file:org.openmaji.implementation.tool.eclipse.ui.dialog.CreateWorksheetDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 */// www .ja  v  a 2 s .com
protected Control createDialogArea(Composite parent) {
    setTitle("Create Worksheet");
    setMessage(
            "Enter the name of the new worksheet and select the subsystem it should use to create new Meems");

    Composite parentComposite = (Composite) super.createDialogArea(parent);

    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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    layout.numColumns = 2;
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    //String defaultUserName = MajiPlugin.getDefault().getPreferenceStore().getString(MajiSystemPreferencePage.MAJI_USERNAME_PROPERTIES);

    Label label = new Label(composite, SWT.WRAP);
    label.setText("&Worksheet Name");

    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    //data.widthHint = widthHint;

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;
    txtWorksheetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    txtWorksheetName.setFocus();
    txtWorksheetName.setLayoutData(data);
    txtWorksheetName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });

    label = new Label(composite, SWT.WRAP);
    label.setText("Subsystem");

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END
            | GridData.VERTICAL_ALIGN_CENTER);

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    comboSubsystem = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);

    populateCombo();

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;

    // horizontal bar
    Label bar = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    data = new GridData();
    data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.FILL;
    bar.setLayoutData(data);
    return composite;
}

From source file:org.openmaji.implementation.tool.eclipse.ui.dialog.LoginDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from  w w w. j  a v  a  2  s  .  c o m
protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    layout.numColumns = 2;
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    String defaultUserName = MajiPlugin.getDefault().getPreferenceStore()
            .getString(MajiSystemPreferencePage.MAJI_USERNAME_PROPERTIES);

    // User name
    Label label = new Label(composite, SWT.WRAP);
    label.setText("&User Name");

    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    //data.widthHint = widthHint;

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;
    txtUserName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    txtUserName.setLayoutData(data);
    txtUserName.setText(defaultUserName);

    // Password
    // User name
    label = new Label(composite, SWT.WRAP);
    label.setText("&Password");

    // Enable Quick-Password Feature for develper
    String quickPassword = System.getProperty(QUICK_PASSWORD);
    if ((quickPassword != null) && (quickPassword.equalsIgnoreCase("true"))) {
        label.addMouseListener(new MouseListener() {
            public void mouseDoubleClick(MouseEvent e) {
                txtPassword.setText(txtUserName.getText() + "99");
            }

            public void mouseDown(MouseEvent e) {
            }

            public void mouseUp(MouseEvent e) {
            }
        });
    }

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END
            | GridData.VERTICAL_ALIGN_CENTER);

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    txtPassword = new Text(composite, SWT.SINGLE | SWT.BORDER);
    txtPassword.setEchoChar('*');
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;
    txtPassword.setLayoutData(data);
    if (defaultUserName.length() > 0)
        txtPassword.setFocus();

    // horizontal bar
    Label bar = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    data = new GridData();
    data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.FILL;
    bar.setLayoutData(data);
    return composite;
}

From source file:org.org.eclipse.core.utils.platform.dialogs.Dialog.java

License:Open Source License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p>//from   w w w .  j a v  a2 s  .c  o  m
 * The <code>Dialog</code> implementation of this framework method lays out a button bar and calls the <code>createButtonsForButtonBar</code> framework method to populate it. Subclasses may override.
 * </p>
 * <p>
 * The returned control's layout data must be an instance of <code>GridData</code>.
 * </p>
 * 
 * @param parent
 *            the parent composite to contain the button bar
 * @return the button bar control
 */
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, COMPOSITE_STYLE);
    // create a layout with spacing and margins appropriate for the font
    // size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    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);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    composite.setBackground(JFaceColors.getBannerBackground(parent.getDisplay()));
    // Add the buttons to the button bar.
    createButtonsForButtonBar(composite);
    return composite;
}

From source file:org.org.eclipse.core.utils.platform.dialogs.Dialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part of this dialog (above the button bar).
 * <p>/*from  www.  j a v  a 2s .  c o m*/
 * The <code>Dialog</code> implementation of this framework method creates and returns a new <code>Composite</code> with standard margins and spacing.
 * </p>
 * <p>
 * The returned control's layout data must be an instance of <code>GridData</code>. This method must not modify the parent's layout.
 * </p>
 * <p>
 * Subclasses must override this method but may call <code>super</code> as in the following example:
 * </p>
 * 
 * <pre>
 * Composite composite = (Composite) super.createDialogArea(parent);
 * //add controls to composite as necessary
 * return composite;
 * </pre>
 * 
 * @param parent
 *            the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NULL);
    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.setBackground(JFaceColors.getBannerBackground(parent.getDisplay()));
    // org.eclipse.jface.dialogs.Dialog.applyDialogFont(composite);
    return composite;
}

From source file:org.org.eclipse.core.utils.platform.dialogs.input.AbstractInputTrayDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, 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  2s .  c  om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);
    if (title != null) {
        Composite titleContainer = new Composite(composite, SWT.NONE);
        titleContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        titleContainer.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay()));
        titleContainer.setLayout(new GridLayout(1, false));
        Label nameLabel = new Label(titleContainer, SWT.NONE);
        nameLabel.setText(title);
        nameLabel.setFont(JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT));
        nameLabel.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay()));
        nameLabel.setForeground(JFaceColors.getBannerForeground(this.getShell().getDisplay()));
        nameLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    }
    Composite fieldsContainer = new Composite(composite, SWT.BORDER);
    fieldsContainer.setLayout(new GridLayout(numColumns, false));
    fieldsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    final Composite validationMessageContainer = new Composite(composite, SWT.BORDER);
    validationMessageContainer.setLayout(new GridLayout(1, false));
    validationMessageContainer.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay()));
    validationMessageContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    validationMessageLabel = new Text(validationMessageContainer, SWT.MULTI | SWT.READ_ONLY);
    validationMessageLabel.setText("");
    validationMessageLabel.setForeground(JFaceColors.getErrorText(this.getShell().getDisplay()));
    validationMessageLabel.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay()));
    validationMessageLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    return fieldsContainer;
}

From source file:org.org.eclipse.core.utils.platform.dialogs.message.AbstractMessageAndButtonDialog.java

License:Open Source License

protected Control createContents(Composite parent) {
    // initialize the dialog units
    initializeDialogUnits(parent);//w ww . j ava 2  s .  c o m
    // create the top level composite for the dialog
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN) * 3 / 2;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING) * 2;
    layout.makeColumnsEqualWidth = false;
    parent.setLayout(layout);
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));
    createDialogAndButtonArea(parent);
    return parent;
}