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

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

Introduction

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

Prototype

int VERTICAL_MARGIN

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

Click Source Link

Document

Vertical 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  www.  ja v a  2s .com*/
        }
    };

    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);//from  w ww. j a  va2s. c  om
    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 . j a  v a  2s .  co  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();/*from   ww w  .  j a v a2  s. c  om*/
        }
    };

    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 {//w ww  .  j  a  v a2s.  com
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}

From source file:com.android.ide.eclipse.adt.internal.launch.DeviceChooserDialog.java

License:Open Source License

/**
 * Create the button bar: We override the Dialog implementation of this method
 * so that we can create the checkbox at the same level as the 'Cancel' and 'OK' buttons.
 *//*w w w. ja va2s .  c om*/
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    mUseDeviceForFutureLaunchesCheckbox = new Button(composite, SWT.CHECK);
    mUseDeviceForFutureLaunchesCheckbox.setSelection(mUseDeviceForFutureLaunches);
    mResponse.setUseDeviceForFutureLaunches(mUseDeviceForFutureLaunches);
    mUseDeviceForFutureLaunchesCheckbox.setText("Use same device for future launches");
    mUseDeviceForFutureLaunchesCheckbox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            mUseDeviceForFutureLaunches = mUseDeviceForFutureLaunchesCheckbox.getSelection();
            mResponse.setUseDeviceForFutureLaunches(mUseDeviceForFutureLaunches);
        }
    });
    mUseDeviceForFutureLaunchesCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(composite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    return composite;
}

From source file:com.android.ide.eclipse.auidt.internal.launch.DeviceChooserDialog.java

License:Open Source License

/**
 * Create the button bar: We override the Dialog implementation of this method
 * so that we can create the checkbox at the same level as the 'Cancel' and 'OK' buttons.
 *//*from   www  .  ja va  2s  . c  om*/
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    mUseDeviceForFutureLaunchesCheckbox = new Button(composite, SWT.CHECK);
    mUseDeviceForFutureLaunchesCheckbox.setSelection(sUseDeviceForFutureLaunchesValue);
    mResponse.setUseDeviceForFutureLaunches(sUseDeviceForFutureLaunchesValue);
    mUseDeviceForFutureLaunchesCheckbox.setText("Use same device for future launches");
    mUseDeviceForFutureLaunchesCheckbox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            sUseDeviceForFutureLaunchesValue = mUseDeviceForFutureLaunchesCheckbox.getSelection();
            mResponse.setUseDeviceForFutureLaunches(sUseDeviceForFutureLaunchesValue);
        }
    });
    mUseDeviceForFutureLaunchesCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(composite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    return composite;
}

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 w  w.ja v a  2s .co 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  ww  w  .j  a  v a 2s .  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/>//from   ww w  .  j a va 2s.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;
}