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:com.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java

License:Open Source License

/**
 * Re-layout the labels for the new message.
 *///from   www .  j av  a  2 s . c  o  m
private void layoutForNewMessage() {
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    // If there are no images then layout as normal
    if (errorMessage == null && messageImage == null) {
        setImageLabelVisible(false);
        setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    } else {
        messageImageLabel.setVisible(true);
        bottomFillerLabel.setVisible(true);
        leftFillerLabel.setVisible(true);
        /**
         * Note that we do not use horizontalSpacing here as when the
         * background of the messages changes there will be gaps between the
         * icon label and the message that are the background color of the
         * shell. We add a leading space elsewhere to compendate for this.
         */
        FormData data = new FormData();
        data.left = new FormAttachment(0, H_GAP_IMAGE);
        data.top = new FormAttachment(titleLabel, verticalSpacing);
        messageImageLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0, SWT.RIGHT);
        bottomFillerLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0);
        leftFillerLabel.setLayoutData(data);
        FormData messageLabelData = new FormData();
        messageLabelData.top = new FormAttachment(titleLabel, verticalSpacing);
        messageLabelData.right = new FormAttachment(titleImageLabel);
        messageLabelData.left = new FormAttachment(messageImageLabel, 0);
        messageLabelData.height = messageLabelHeight;
        if (titleImageLargest)
            messageLabelData.bottom = new FormAttachment(titleImageLabel, 0, SWT.BOTTOM);
        messageLabel.setLayoutData(messageLabelData);
    }
    // Do not layout before the dialog area has been created
    // to avoid incomplete calculations.
    if (dialogArea != null)
        workArea.getParent().layout(true);
}

From source file:com.hangum.tadpole.commons.exception.dialog.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite and calls <code>createMessageArea</code> and
 * <code>createCustomArea</code> to populate it. Subclasses should
 * override <code>createCustomArea</code> to add contents below the
 * message.// ww  w  . ja  v a2  s .c  o m
 */
protected Control createDialogArea(Composite parent) {
    createMessageArea(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);
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return composite;
}

From source file:com.hangum.tadpole.exception.dialog.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite and calls <code>createMessageArea</code> and
 * <code>createCustomArea</code> to populate it. Subclasses should
 * override <code>createCustomArea</code> to add contents below the
 * message.//from w w  w  .  j  a v  a2s .c om
 */
protected Control createDialogArea(Composite parent) {
    createMessageArea(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);
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());
    return composite;
}

From source file:com.ibm.research.tours.dialogs.TimeDialog.java

License:Open Source License

@Override
protected Control createDialogArea(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);/* www  .j  a v  a  2 s .com*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    fTimeCheckButton = new Button(composite, SWT.CHECK);
    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);
    fTimeCheckButton.setLayoutData(data);
    fTimeCheckButton.setText(fMessage);
    fTimeCheckButton.setSelection(fIsTimeSet);

    fTimeCheckButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fIsTimeSet = fTimeCheckButton.getSelection();
            fMinuteSpinner.setEnabled(fIsTimeSet);
            fSecondSpinner.setEnabled(fIsTimeSet);
        }

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

    Group timeGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
    GridLayout groupLayout = new GridLayout(4, false);
    timeGroup.setLayout(groupLayout);
    GridData timeGroupData = new GridData(GridData.FILL_BOTH);
    timeGroupData.horizontalSpan = 2;
    timeGroup.setLayoutData(timeGroupData);
    timeGroup.setText("Time Limit");

    Label minuteLabel = new Label(timeGroup, SWT.NONE);
    minuteLabel.setText("Minutes");
    fMinuteSpinner = new Spinner(timeGroup, SWT.BORDER);

    if (fTimeLimit != null)
        fMinuteSpinner.setSelection(fTimeLimit.getMinutes());

    fMinuteSpinner.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (fTimeLimit != null)
                fTimeLimit.setMinutes(fMinuteSpinner.getSelection());
        }
    });

    Label secondLabel = new Label(timeGroup, SWT.NONE);
    secondLabel.setText("Seconds");
    fSecondSpinner = new Spinner(timeGroup, SWT.BORDER);
    fSecondSpinner.setMaximum(60);

    if (fTimeLimit != null)
        fSecondSpinner.setSelection(fTimeLimit.getSeconds());

    fSecondSpinner.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (fTimeLimit != null)
                fTimeLimit.setSeconds(fSecondSpinner.getSelection());
        }
    });

    fMinuteSpinner.setEnabled(fIsTimeSet);
    fSecondSpinner.setEnabled(fIsTimeSet);

    return parent;
}

From source file:com.ibm.xsp.extlib.designer.bluemix.preference.PreferencePage.java

License:Open Source License

@Override
protected void createPageContents() {
    loadProfileList();/*from  w  w w . j av a 2 s.  c om*/

    Group group = createGroup(BluemixUtil.productizeString("%BM_PRODUCT% Server"), 2); // $NLX-PreferencePage.IBMBluemixServer-1$

    WizardUtils.createLabel(group, "&URL:", 1); // $NLX-PreferencePage.URL-1$
    _serverCombo = WizardUtils.createEditCombo(group, 1, BLUEMIX_SERVERS, -1, null);

    WizardUtils.createLabel(group, "Use&rname:", 1); // $NLX-PreferencePage.Username-1$
    _usernameText = WizardUtils.createText(group, 1);

    WizardUtils.createLabel(group, "&Password:", 1); // $NLX-PreferencePage.Password-1$
    _passwordText = WizardUtils.createPasswordText(group, 1);

    _testButton = WizardUtils.createButton(group, "Test &connection...", this,
            GridData.HORIZONTAL_ALIGN_BEGINNING, 2); // $NLX-PreferencePage.Testconnection-1$
    GridData gd = (GridData) _testButton.getLayoutData();
    gd.verticalIndent = 7;

    // Deployment Group
    group = createGroup("Deployment"); // $NLX-PreferencePage.Deployment-1$

    PreferenceWidget pw = addField(KEY_BLUEMIX_DEPLOY_WAIT, "&Wait for all instances to start", // $NLX-PreferencePage.Waitforallinstancestostart-1$
            BOOLEAN_PREF, group);
    _waitButton = (Button) pw.getWidget();
    _waitButton.addSelectionListener(this);
    gd = (GridData) _waitButton.getLayoutData();
    gd.verticalIndent = 7;

    _deployComposite = createChildComposite(group);

    pw = addField(KEY_BLUEMIX_DEPLOY_WAIT_TIMEOUT, "&Timeout (seconds):", // $NLX-PreferencePage.Timeoutseconds-1$
            INTEGER_PREF, _deployComposite, 60, 600);
    GridData width = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    ;
    width.widthHint = 70;
    ((Control) pw.getWidget()).setLayoutData(GridDataFactory.copyData(width));

    addField(KEY_BLUEMIX_DEPLOY_WAIT_SHOW_SUCCESS, "Display &success dialog when complete", // $NLX-PreferencePage.Displaysuccessdialogwhencomplete-1$
            BOOLEAN_PREF, _deployComposite, 2);

    // Hybrid connection
    group = createGroup("Hybrid Integration Profiles", 2); // $NLX-PreferencePage.HybridIntegrationProfiles-1$
    _hybridTableEditor = new ManifestTableEditor(group, 1, new String[] { "name" }, new String[] { "Name" },
            true, false, 8, 60, "hybrid.profile.table.id", _profileList, false, null, this, this); // $NON-NLS-1$ $NON-NLS-3$ $NLX-PreferencePage.Name-2$ 
    gd = (GridData) _hybridTableEditor.getLayoutData();
    gd.verticalIndent = 7;

    Composite buttonComposite = new Composite(group, SWT.NONE);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.numColumns = 1;
    buttonLayout.marginWidth = 0;
    buttonLayout.marginHeight = 0;
    buttonLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    buttonComposite.setLayout(buttonLayout);

    GridData buttonLayoutData = new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
    buttonLayoutData.verticalIndent = 7;
    buttonComposite.setLayoutData(buttonLayoutData);
    buttonComposite.setFont(group.getFont());

    _newProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _newProfileButton.setText("&New..."); // $NLX-PreferencePage.New-1$
    _newProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _newProfileButton.addSelectionListener(this);

    _editProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _editProfileButton.setText("&Edit..."); // $NLX-PreferencePage.Edit-1$
    _editProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _editProfileButton.addSelectionListener(this);

    _dupProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _dupProfileButton.setText("Dupl&icate"); // $NLX-PreferencePage.Duplicate-1$
    _dupProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _dupProfileButton.addSelectionListener(this);

    _deleteProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _deleteProfileButton.setText("De&lete"); // $NLX-PreferencePage.Delete-1$
    _deleteProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _deleteProfileButton.addSelectionListener(this);

    // Set the initial value for the non-widget controls
    _serverCombo.setText(getSecurePreference(KEY_BLUEMIX_SERVER_URL, ""));
    _usernameText.setText(getSecurePreference(KEY_BLUEMIX_SERVER_USERNAME, ""));
    _passwordText.setText(getSecurePreference(KEY_BLUEMIX_SERVER_PASSWORD, ""));
}

From source file:com.iw.plugins.spindle.ui.preferences.AbstractPreferencePage.java

License:Open Source License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;/*  w  w w .j  a  v a 2  s . c om*/
    gd.widthHint = 0;
    group.setLayoutData(gd);
    group.setFont(parent.getFont());

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

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

From source file:com.iw.plugins.spindle.ui.preferences.SpindleEditorPreferencePage.java

License:Mozilla Public License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;/*from   www . j  a  v  a  2  s . com*/
    // gd.widthHint = 0;
    group.setLayoutData(gd);
    group.setFont(parent.getFont());

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

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

From source file:com.iw.plugins.spindle.ui.preferences.SpindleGeneralPreferencePage.java

License:Mozilla Public License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;/*from   w  w  w. j a v  a  2 s.c  o m*/
    //    gd.widthHint = 0;
    group.setLayoutData(gd);
    group.setFont(parent.getFont());

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

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

From source file:com.jaspersoft.studio.jface.dialogs.DataAdapterErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite. Subclasses that require a different dialog area
 * may either override this method, or call the <code>super</code>
 * implementation and add controls to the created composite.
 * //from   w  w w.j a  va2s .  co  m
 * Note:  Since 3.4, the created composite no longer grabs excess vertical space.
 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=72489.
 * If the old behavior is desired by subclasses, get the returned composite's
 * layout data and set grabExcessVerticalSpace to true.
 */
@Override
protected Control createDialogArea(Composite parent) {
    // Create a composite with standard margins and spacing
    // Add the messageArea to this composite so that as subclasses add widgets to the messageArea
    // and dialogArea, the number of children of parent remains fixed and with consistent layout.
    // Fixes bug #240135
    Composite composite = new Composite(parent, SWT.NONE);
    createMessageArea(composite);
    createSupportArea(parent);
    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 = 2;
    composite.setLayout(layout);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    childData.grabExcessVerticalSpace = false;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    return composite;
}

From source file:com.liferay.ide.project.ui.dialog.ProjectSelectionDialog.java

License:Open Source License

private void addSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;/* w ww  .j av  a  2  s  .  c  o  m*/
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));
    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select All", false);

    SelectionListener listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fTableViewer.setAllChecked(true);
            getOkButton().setEnabled(true);

        }
    };

    selectButton.addSelectionListener(listener);
    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "Deselect All",
            false);

    listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fTableViewer.setAllChecked(false);
            getOkButton().setEnabled(false);
        }
    };

    deselectButton.addSelectionListener(listener);
}