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:com.amazonaws.eclipse.ec2.ui.keypair.CreateKeyPairDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            updateOkButton();/*from w  w  w . j a va2 s. c  om*/
        }
    };

    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.verticalSpacing = 0;
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    composite.setLayout(gridLayout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    GridData gridData;

    Label label = new Label(composite, SWT.NONE);
    label.setText("Key Pair Name:");
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalAlignment = SWT.LEFT;
    gridData.verticalAlignment = SWT.CENTER;
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);

    keyPairNameText = new Text(composite, SWT.BORDER);
    keyPairNameText.addModifyListener(listener);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 3;
    keyPairNameText.setLayoutData(gridData);

    label = new Label(composite, SWT.NONE);
    label.setText("Private Key Directory:");
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalAlignment = SWT.LEFT;
    gridData.verticalAlignment = SWT.CENTER;
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);

    privateKeyDirectoryText = new Text(composite, SWT.BORDER);
    privateKeyDirectoryText.addModifyListener(listener);

    File defaultPrivateKeyDirectory = KeyPairManager.getDefaultPrivateKeyDirectory();
    if (defaultPrivateKeyDirectory != null) {
        privateKeyDirectoryText.setText(defaultPrivateKeyDirectory.getAbsolutePath());
    }

    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;
    gridData.widthHint = 300;
    privateKeyDirectoryText.setLayoutData(gridData);

    Button button = new Button(composite, SWT.PUSH);
    button.setText("Browse...");
    button.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell());
            String directoryPath = dialog.open();

            privateKeyDirectoryText.setText(directoryPath);
        }
    });

    applyDialogFont(composite);

    return composite;
}

From source file:com.amazonaws.eclipse.ec2.ui.securitygroups.CreateSecurityGroupDialog.java

License:Apache License

private Composite createComposite(Composite parent) {
    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(1);
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    composite.setLayout(gridLayout);/* ww w .  j av a2s.c o  m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    return composite;
}

From source file:com.amazonaws.eclipse.ec2.ui.securitygroups.EditSecurityGroupPermissionEntryDialog.java

License:Apache License

private Composite createComposite(Composite parent) {
    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    gridLayout.marginHeight = 2;/*from w  w w  . ja  va  2  s .c o  m*/

    composite.setLayout(gridLayout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    return composite;
}

From source file:com.amazonaws.eclipse.ec2.ui.views.instances.BundleDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            updateOkButton();// ww  w  .  java  2s.  c o m
        }
    };

    this.getShell().setText("Bundle Image");

    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    composite.setLayout(gridLayout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    GridData gridData;

    Label label = new Label(composite, SWT.NONE);
    label.setText("Amazon S3 Bucket:");
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalAlignment = SWT.LEFT;
    gridData.verticalAlignment = SWT.CENTER;
    label.setLayoutData(gridData);

    bucketNameText = new Text(composite, SWT.BORDER);
    bucketNameText.addModifyListener(listener);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 300;
    bucketNameText.setLayoutData(gridData);

    label = new Label(composite, SWT.NONE);
    label.setText("Image Name:");
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalAlignment = SWT.LEFT;
    gridData.verticalAlignment = SWT.CENTER;
    label.setLayoutData(gridData);

    imageNameText = new Text(composite, SWT.BORDER);
    imageNameText.addModifyListener(listener);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 300;
    imageNameText.setLayoutData(gridData);

    applyDialogFont(composite);

    return composite;
}

From source file:com.amazonaws.eclipse.sdk.ui.wizard.NewAwsJavaProjectWizardPageOne.java

License:Open Source License

private GridLayout initGridLayout(GridLayout layout, boolean margins) {
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    if (margins) {
        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {/*from   w  w w  .jav a  2 s  .  c o m*/
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}

From source file:com.android.sdkuilib.ApkConfigEditDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout;/*  w ww.j  a  va 2  s. c o  m*/
    composite.setLayout(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.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label l = new Label(composite, SWT.NONE);
    l.setText("Name");

    mNameField = new Text(composite, SWT.BORDER);
    mNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mNameField.addVerifyListener(this);
    if (mName != null) {
        mNameField.setText(mName);
    }
    mNameField.addModifyListener(this);

    l = new Label(composite, SWT.NONE);
    l.setText("Filter");

    mFilterField = new Text(composite, SWT.BORDER);
    mFilterField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (mFilter != null) {
        mFilterField.setText(mFilter);
    }
    mFilterField.addVerifyListener(this);
    mFilterField.addModifyListener(this);

    applyDialogFont(composite);
    return composite;
}

From source file:com.android.sdkuilib.internal.repository.SdkUpdaterChooserDialog.java

License:Apache License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p/>//from   w ww. j a  v  a2 s  .  com
 * This reimplements most of the code from the base class with a few exceptions:
 * <ul>
 * <li>Enforces 3 columns.
 * <li>Inserts a full-width error label.
 * <li>Inserts a help label on the left of the first button.
 * <li>Renames the OK button into "Install"
 * </ul>
 */
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = false;
    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(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Error message area
    mErrorLabel = new Label(composite, SWT.NONE);
    mErrorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    // Label at the left of the install/cancel buttons
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    label.setText("[*] Something depends on this package");
    label.setEnabled(false);
    layout.numColumns++;

    // Add the ok/cancel to the button bar.
    createButtonsForButtonBar(composite);

    // the ok button should be an "install" button
    Button button = getButton(IDialogConstants.OK_ID);
    button.setText("Install");

    return composite;
}

From source file:com.android.sdkuilib.internal.repository.UpdateChooserDialog.java

License:Apache License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p/>/*  w ww.  j  a v a2 s  .c o m*/
 * This reimplements most of the code from the base class with a few exceptions:
 * <ul>
 * <li>Enforces 3 columns.
 * <li>Inserts a full-width error label.
 * <li>Inserts a help label on the left of the first button.
 * <li>Renames the OK button into "Install"
 * </ul>
 */
@Override
protected Control createButtonBar(Composite parent) {

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = false;
    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(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Error message area
    mErrorLabel = new Label(composite, SWT.NONE);
    mErrorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    // Label at the left of the install/cancel buttons
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    label.setText("[*] Something depends on this package");
    label.setEnabled(false);
    layout.numColumns++;

    // Add the ok/cancel to the button bar.
    createButtonsForButtonBar(composite);

    // the ok button should be an "install" button
    Button button = getButton(IDialogConstants.OK_ID);
    button.setText("Install");

    return composite;
}

From source file:com.android.sdkuilib.ui.GridDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite top = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(mNumColumns, mMakeColumnsEqualWidth);
    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);//from   ww w  .ja va 2  s . c om
    top.setLayoutData(new GridData(GridData.FILL_BOTH));

    createDialogContent(top);

    applyDialogFont(top);
    return top;
}

From source file:com.aptana.formatter.ui.preferences.AlreadyExistsDialog.java

License:Open Source License

private void initializeComposite(Composite parent) {
    fComposite = new Composite(parent, SWT.NULL);

    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);
    layout.numColumns = NUM_COLUMNS;/*from   w w  w  .  j  ava 2  s . c om*/

    fComposite.setLayout(layout);
}