Example usage for org.eclipse.jface.layout GridDataFactory copy

List of usage examples for org.eclipse.jface.layout GridDataFactory copy

Introduction

In this page you can find the example usage for org.eclipse.jface.layout GridDataFactory copy.

Prototype

public GridDataFactory copy() 

Source Link

Document

Creates a copy of the receiver.

Usage

From source file:com.amazonaws.eclipse.android.sdk.newproject.AndroidProjectWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    setControl(composite);/*from   ww  w. j  a va 2 s .c om*/

    GridDataFactory factory = GridDataFactory.fillDefaults();
    factory.grab(true, false);

    new Label(composite, SWT.NONE).setText("Project Name:");
    projectNameText = new Text(composite, SWT.BORDER);
    factory.applyTo(projectNameText);

    new Label(composite, SWT.NONE).setText("Java Package Name:");
    packageNameText = new Text(composite, SWT.BORDER);
    factory.applyTo(packageNameText);

    sampleCodeButton = new Button(composite, SWT.CHECK);
    sampleCodeButton.setText("Start with sample application");
    sampleCodeButton.setSelection(true);
    factory.copy().span(2, 1).applyTo(packageNameText);

    androidTargetSelectorComposite = new Composite(composite, SWT.NONE);
    androidTargetSelectorComposite.setLayout(new GridLayout());
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    gridData.horizontalSpan = 2;
    gridData.heightHint = 200;
    androidTargetSelectorComposite.setLayoutData(gridData);

    sdkTargetSelector = new SdkTargetSelector(androidTargetSelectorComposite, null);

    IAndroidTarget[] targets = new IAndroidTarget[0];
    if (Sdk.getCurrent() != null) {
        targets = Sdk.getCurrent().getTargets();
    }
    sdkTargetSelector.setTargets(targets);

    // Check to see if we have an SDK. If we don't, we need to wait before
    // continuing
    AndroidSdkManager sdkManager = AndroidSdkManager.getInstance();
    synchronized (sdkManager) {
        AndroidSdkInstall defaultSDKInstall = sdkManager.getDefaultSdkInstall();

        if (defaultSDKInstall != null) {
            sdkInstalled = true;
        } else {
            setPageComplete(false);

            Job installationJob = sdkManager.getInstallationJob();
            if (installationJob == null) {
                JavaSdkPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JavaSdkPlugin.PLUGIN_ID,
                        "Unable to check status of AWS SDK for Android download"));
                return;
            }

            final Composite pleaseWait = new Composite(composite, SWT.None);
            pleaseWait.setLayout(new GridLayout(1, false));
            GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
            layoutData.horizontalSpan = 2;
            pleaseWait.setLayoutData(layoutData);
            Label label = new Label(pleaseWait, SWT.None);
            label.setText("The AWS SDK for Android is currently downloading.  Please wait while it completes.");
            label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            ProgressBar progressBar = new ProgressBar(pleaseWait, SWT.INDETERMINATE);
            progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

            installationJob.addJobChangeListener(new JobChangeAdapter() {
                @Override
                public void done(IJobChangeEvent event) {
                    Display.getDefault().syncExec(new Runnable() {
                        public void run() {
                            sdkInstalled = true;
                            pleaseWait.dispose();
                            composite.getParent().layout();
                            composite.getShell().pack(true);
                            composite.getParent().redraw();
                            updateErrorMessage();
                        }
                    });
                }
            });
        }
    }

    bindControls();
    updateErrorMessage();
}

From source file:com.amazonaws.eclipse.core.ui.setupwizard.ConfigureAccountWizardPage.java

License:Apache License

public void createControl(Composite parent) {
    parent.setLayout(new GridLayout());

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(450, 250));
    composite.setLayout(new GridLayout(2, false));
    setControl(composite);/*from www .j a  va  2  s .  c  o m*/

    WebLinkListener linkListener = new WebLinkListener();
    GridDataFactory fullRowGridDataFactory = GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.TOP)
            .grab(true, false).span(2, 1);
    GridDataFactory firstColumnGridDataFactory = GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER);
    GridDataFactory secondColumnGridDataFactory = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP)
            .grab(true, false);

    Label label = new Label(composite, SWT.WRAP);
    label.setText("Before you can start using the toolkit, you need to configure an AWS account.");
    fullRowGridDataFactory.applyTo(label);

    Link link = new Link(composite, SWT.WRAP);
    link.addListener(SWT.Selection, linkListener);
    link.setText("Use your <a href=\"" + SECURITY_CREDENTIALS_URL + "\">existing credentials</a> or "
            + "<a href=\"" + CREATE_ACCOUNT_URL + "\">create a new AWS account</a>.");
    fullRowGridDataFactory.applyTo(link);

    // AWS Access Key ID row
    Label accessKeyLabel = new Label(composite, SWT.NONE);
    accessKeyLabel.setText("Access Key ID:");
    firstColumnGridDataFactory.copy().indent(10, 5).applyTo(accessKeyLabel);
    Text accessKeyText = new Text(composite, SWT.BORDER);
    secondColumnGridDataFactory.copy().indent(0, 5).applyTo(accessKeyText);
    accessKeyText.setFocus();

    IObservableValue accessKeyModelObservable = PojoObservables.observeValue(dataModel,
            dataModel.ACCESS_KEY_ID);
    bindingContext.bindValue(SWTObservables.observeText(accessKeyText, SWT.Modify), accessKeyModelObservable);
    bindingContext.addValidationStatusProvider(new ChainValidator<String>(accessKeyModelObservable,
            new NotEmptyValidator("Please provide an AWS Access Key ID")));

    // AWS Secret Key row
    Label secretKeyLabel = new Label(composite, SWT.NONE);
    secretKeyLabel.setText("Secret Access Key:");
    firstColumnGridDataFactory.copy().indent(10, 0).applyTo(secretKeyLabel);
    Text secretKeyText = new Text(composite, SWT.BORDER);
    secondColumnGridDataFactory.applyTo(secretKeyText);

    IObservableValue secretKeyModelObservable = PojoObservables.observeValue(dataModel,
            dataModel.SECRET_ACCESS_KEY);
    bindingContext.bindValue(SWTObservables.observeText(secretKeyText, SWT.Modify), secretKeyModelObservable);
    bindingContext.addValidationStatusProvider(new ChainValidator<String>(secretKeyModelObservable,
            new NotEmptyValidator("Please provide an AWS Secret Access Key")));

    // Open Explorer view row
    openExplorerCheckBox = new Button(composite, SWT.CHECK);
    openExplorerCheckBox.setText("Open the AWS Explorer view");
    openExplorerCheckBox.setSelection(true);
    fullRowGridDataFactory.indent(0, 5).applyTo(openExplorerCheckBox);
    bindingContext.bindValue(SWTObservables.observeSelection(openExplorerCheckBox),
            PojoObservables.observeValue(dataModel, dataModel.OPEN_EXPLORER));

    Composite spacer = new Composite(composite, SWT.NONE);
    spacer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 2, 1));

    link = new Link(composite, SWT.WRAP);
    link.addListener(SWT.Selection, linkListener);
    link.setText("For a full walkthrough of the features available in the AWS Toolkit for Eclipse, "
            + "see the <a href=\"" + GETTING_STARTED_GUIDE_URL
            + "\">AWS Toolkit for Eclipse Getting Started Guide</a>.");
    fullRowGridDataFactory.applyTo(link);

    aggregateValidationStatus.addChangeListener(new IChangeListener() {
        public void handleChange(ChangeEvent event) {
            Object value = aggregateValidationStatus.getValue();
            if (value instanceof IStatus == false)
                return;

            IStatus status = (IStatus) value;
            setPageComplete(status.isOK());
        }
    });

    setPageComplete(false);
    parent.getShell().pack(true);

    Rectangle workbenchBounds = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getBounds();
    Point dialogSize = this.getShell().getSize();

    this.getShell().setLocation(workbenchBounds.x + (workbenchBounds.width - dialogSize.x) / 2,
            workbenchBounds.y + (workbenchBounds.height - dialogSize.y) / 2);
}

From source file:com.amazonaws.eclipse.explorer.cloudformation.StackEditor.java

License:Apache License

private void createSummarySection(Composite parent, FormToolkit toolkit) {
    GridDataFactory gridDataFactory = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false)
            .minSize(200, SWT.DEFAULT).hint(200, SWT.DEFAULT);

    Composite composite = toolkit.createComposite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    composite.setLayout(new GridLayout(4, false));

    toolkit.createLabel(composite, "Stack Name:");
    stackNameLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(stackNameLabel);

    toolkit.createLabel(composite, "Created:");
    createdLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(createdLabel);

    toolkit.createLabel(composite, "Status:");
    statusLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(statusLabel);

    toolkit.createLabel(composite, "Create Timeout:");
    createTimeoutLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(createTimeoutLabel);

    toolkit.createLabel(composite, "Status Reason:");
    statusReasonLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(statusReasonLabel);

    toolkit.createLabel(composite, "Last Updated:");
    lastUpdatedLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(lastUpdatedLabel);

    toolkit.createLabel(composite, "Rollback on Failure:");
    rollbackOnFailureLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE);
    toolkit.createLabel(composite, "");
    toolkit.createLabel(composite, "");

    Label l = toolkit.createLabel(composite, "Description:");
    gridDataFactory.copy().hint(100, SWT.DEFAULT).minSize(1, SWT.DEFAULT).align(SWT.LEFT, SWT.TOP)
            .grab(false, false).applyTo(l);
    descriptionLabel = new Text(composite, SWT.READ_ONLY | SWT.NONE | SWT.MULTI | SWT.WRAP);
    gridDataFactory.copy().span(3, 1).applyTo(descriptionLabel);
}

From source file:com.amazonaws.eclipse.explorer.identitymanagement.PasswordPolicyForm.java

License:Apache License

public PasswordPolicyForm(AmazonIdentityManagement iam, Composite parent, FormToolkit toolkit) {
    super(parent, SWT.NONE);

    this.iam = iam;

    GridDataFactory gridDataFactory = GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP)
            .grab(true, false).minSize(200, SWT.DEFAULT).hint(200, SWT.DEFAULT);

    this.setLayout(new GridLayout(2, false));
    this.setBackground(toolkit.getColors().getBackground());

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalSpan = 2;//from ww  w  . j a v  a 2s.  c  om

    Composite comp = toolkit.createComposite(this);
    comp.setLayoutData(gridData);

    comp.setLayout(new GridLayout(2, false));

    toolkit.createLabel(comp, "")
            .setImage(AwsToolkitCore.getDefault().getImageRegistry().get(AwsToolkitCore.IMAGE_INFORMATION));
    headerLabel = toolkit.createLabel(comp, "");
    gridDataFactory.copy().minSize(SWT.MAX, SWT.MAX).applyTo(headerLabel);

    toolkit.createLabel(this, "Minimum Password Length:");
    minCharacterLable = new Text(this, SWT.BORDER | SWT.WRAP | SWT.NONE);
    gridDataFactory.applyTo(minCharacterLable);

    requireUpppercaseButton = toolkit.createButton(this, "", SWT.CHECK);
    toolkit.createLabel(this, "Require at least one uppercase letter");
    requireLowercaseButtion = toolkit.createButton(this, "", SWT.CHECK);
    toolkit.createLabel(this, "Require at least one lowercase letter");

    requireNumbersButton = toolkit.createButton(this, "", SWT.CHECK);
    toolkit.createLabel(this, "Require at least one number");

    requireSymbolsButton = toolkit.createButton(this, "", SWT.CHECK);
    toolkit.createLabel(this, "Require at least one non-alphanumeric character");

    allowChangePasswordButton = toolkit.createButton(this, "", SWT.CHECK);
    toolkit.createLabel(this, "Allow users to change their own password");

    applyPolicyButton = toolkit.createButton(this, "Apply Password Policy", SWT.PUSH);
    applyPolicyButton.addSelectionListener(new AddPasswordPolicySelectionListener());

    deletePolicyButton = toolkit.createButton(this, "Delete Password Policy", SWT.PUSH);
    deletePolicyButton.addSelectionListener(new DeletePasswordPolicySelectionLister());

    refresh();
}

From source file:com.amazonaws.eclipse.identitymanagement.role.RoleSummary.java

License:Apache License

public RoleSummary(AmazonIdentityManagement iam, Composite parent, FormToolkit toolkit) {
    super(parent, SWT.NONE);

    this.iam = iam;

    GridDataFactory gridDataFactory = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false)
            .minSize(200, SWT.DEFAULT).hint(200, SWT.DEFAULT);

    this.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    this.setLayout(new GridLayout(4, false));
    this.setBackground(toolkit.getColors().getBackground());

    toolkit.createLabel(this, "Role ARN:");
    roleARNLabel = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(roleARNLabel);

    toolkit.createLabel(this, "Instance Profile ARN(s):");
    instanceProfileLabel = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(instanceProfileLabel);

    toolkit.createLabel(this, "Path:");
    pathLabel = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(pathLabel);/*from   ww w. j av a 2  s .  c  o  m*/

    toolkit.createLabel(this, "Creation Time:");
    creationTimeLabel = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(creationTimeLabel);

    Link link = new Link(this, SWT.NONE | SWT.WRAP);
    link.setBackground(toolkit.getColors().getBackground());
    link.setText("\nFor more information about IAM roles, see " + "<a href=\"" + ConceptUrl
            + "\">Delegating API access by using roles</a> in the using IAM guide.");

    link.addListener(SWT.Selection, new WebLinkListener());

    gridDataFactory.copy().span(4, SWT.DEFAULT).applyTo(link);

}

From source file:com.amazonaws.eclipse.identitymanagement.user.UpdatePasswordDialog.java

License:Apache License

private Composite createContentPasswordLayout(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    composite.setLayout(new GridLayout(1, false));
    composite.setBackground(toolkit.getColors().getBackground());

    GridDataFactory gridDataFactory = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false)
            .minSize(200, SWT.DEFAULT).span(2, SWT.DEFAULT).hint(200, SWT.DEFAULT);

    toolkit.createLabel(composite, "Password:");
    passwordText = toolkit.createText(composite, "", SWT.BORDER);
    gridDataFactory.copy().span(2, SWT.DEFAULT).applyTo(passwordText);
    toolkit.createLabel(composite, "Confirm Password:");
    passwordText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validate();/*  w  w w. ja v  a  2  s .  c  o  m*/
        }
    });

    confirmPasswordText = toolkit.createText(composite, "", SWT.BORDER);
    gridDataFactory.copy().span(2, SWT.DEFAULT).applyTo(confirmPasswordText);
    confirmPasswordText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validate();
        }
    });
    return composite;
}

From source file:com.n1nja.eclipse.wst.sdt.ui.SasspathPropertyPage.java

License:Open Source License

@Override
protected Control createContents(final Composite parent) {
    final GridLayoutFactory pageLayout = GridLayoutFactory.swtDefaults().numColumns(2);
    final GridDataFactory primaryData = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true,
            true);//w w  w.ja va 2s. c  o  m
    final GridDataFactory secondaryData = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
            false);
    final Composite page = new Composite(parent, SWT.NONE);
    page.setLayout(pageLayout.create());
    final SasspathTree tree = new SasspathTree(this.sasspath, page, SWT.BORDER);
    tree.getComposite().setLayoutData(primaryData.create());
    final GridLayoutFactory buttonLayout = GridLayoutFactory.fillDefaults().numColumns(1);
    final Composite buttons = new Composite(page, SWT.NONE);
    buttons.setLayoutData(primaryData.create());
    buttons.setLayout(buttonLayout.create());
    final Button addButton = new Button(buttons, SWT.NONE);
    addButton.setLayoutData(secondaryData.create());
    addButton.setText("Add Input\u2026");
    addButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            tree.add();
        }
    });
    final Button editButton = new Button(buttons, SWT.NONE);
    editButton.setLayoutData(secondaryData.create());
    editButton.setText("Edit\u2026");
    editButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            tree.edit();
        }
    });
    final Button removeButton = new Button(buttons, SWT.NONE);
    removeButton.setLayoutData(secondaryData.create());
    removeButton.setText("Remove");
    removeButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            tree.remove();
        }
    });
    tree.getComposite().addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            final boolean selected = tree.getComposite().getSelection().length != 1;
            editButton.setGrayed(selected);
            removeButton.setGrayed(selected);
        }
    });
    final Button enableButton = new Button(page, SWT.CHECK);
    enableButton.setLayoutData(secondaryData.create());
    enableButton.setText("Allow individual output folders");
    enableButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(final SelectionEvent e) {
            SasspathPropertyPage.this.sasspath.setEntryOutputEnabled(enableButton.getSelection());
            tree.update();
        }

        public void widgetDefaultSelected(final SelectionEvent e) {
        }
    });
    final Label defoutLabel = new Label(page, SWT.NONE);
    defoutLabel.setLayoutData(secondaryData.copy().span(2, 1).create());
    defoutLabel.setText("Default output folder:");
    final Text defoutField = new Text(page, SWT.BORDER);
    defoutField.setLayoutData(secondaryData.copy().span(2, 1).create());
    defoutField.setText(this.sasspath.getDefaultOutput().toString());
    defoutField.addModifyListener(new ModifyListener() {
        public void modifyText(final ModifyEvent e) {
            SasspathPropertyPage.this.sasspath.setDefaultOutput(Path.fromOSString(defoutField.getText()));
        }
    });
    return page;
}

From source file:com.nokia.carbide.cpp.internal.pi.button.ui.BupProfileEditDialog.java

License:Open Source License

public Control createDialogArea(Composite parent) {
    getShell().setText(/*w w w .  j  a v  a  2 s .co m*/
            Messages.getString("BupProfileEditDialog.editingProfile") + profileForThisEdit.getProfileId()); //$NON-NLS-1$
    setTitleImage(ButtonPlugin.getImageDescriptor("icons/PI_Meter_20x20.png").createImage()); //$NON-NLS-1$
    setTitle(Messages.getString("BupProfileEditDialog.profile") + profileForThisEdit.getProfileId()); //$NON-NLS-1$

    GridLayoutFactory layoutExpandBoth = GridLayoutFactory.fillDefaults();
    GridDataFactory gridDataExpandBoth = GridDataFactory.fillDefaults().grab(true, true);

    GridLayoutFactory gridLayoutButton = GridLayoutFactory.swtDefaults();
    GridDataFactory gridDataButton = GridDataFactory.swtDefaults();

    content = new Composite(parent, SWT.NONE);
    layoutExpandBoth.applyTo(content);
    gridDataExpandBoth.applyTo(content);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(content,
            ComNokiaCarbidePiButtonHelpIDs.PI_PROFILE_EDIT_DIALOG);

    localeMappingGroup = new Group(content, SWT.NONE);
    layoutExpandBoth.applyTo(localeMappingGroup);
    gridDataExpandBoth.applyTo(localeMappingGroup);

    mappingComposite = new Composite(localeMappingGroup, SWT.NONE);
    layoutExpandBoth.copy().numColumns(2).applyTo(mappingComposite);
    gridDataExpandBoth.applyTo(mappingComposite);
    mappingTableViewer = new BupMapTableViewer(mappingComposite, true);
    Table mappingTable = mappingTableViewer.getTable();
    // enable the edit button only when a single file filter is selected
    mappingTable.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            handleViewerSelection();
        }
    });

    int maxWidth;
    buttonComposite = new Composite(mappingComposite, SWT.NONE);
    gridLayoutButton.applyTo(buttonComposite);
    gridDataButton.copy().align(SWT.CENTER, SWT.FILL).grab(false, true).applyTo(buttonComposite);
    addButton = new Button(buttonComposite, SWT.NONE);
    addButton.setText(Messages.getString("BupProfileEditDialog.add")); //$NON-NLS-1$
    addButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            handleAdd();
        }
    });
    maxWidth = buttonComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    editButton = new Button(buttonComposite, SWT.NONE);
    editButton.setText(Messages.getString("BupProfileEditDialog.edit")); //$NON-NLS-1$
    editButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            handleEdit();
        }
    });
    maxWidth = Math.max(maxWidth, editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
    removeButton = new Button(buttonComposite, SWT.NONE);
    removeButton.setText(Messages.getString("BupProfileEditDialog.remove")); //$NON-NLS-1$
    removeButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            handleRemove();
        }
    });
    maxWidth = Math.max(maxWidth, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
    //dummy label as divider
    new Label(buttonComposite, SWT.NONE);
    new Label(buttonComposite, SWT.NONE);
    new Label(buttonComposite, SWT.NONE);
    new Label(buttonComposite, SWT.NONE);
    new Label(buttonComposite, SWT.NONE);
    clearButton = new Button(buttonComposite, SWT.NONE);
    clearButton.setText(Messages.getString("BupProfileEditDialog.clearProfile")); //$NON-NLS-1$
    clearButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent arg0) {
        }

        public void widgetSelected(SelectionEvent arg0) {
            if (MessageDialog.openQuestion(getShell(), Messages.getString("BupProfileEditDialog.clearProfile"), //$NON-NLS-1$
                    Messages.getString("BupProfileEditDialog.clearAllConfirm"))) { //$NON-NLS-1$
                Set<Integer> keySet = cachedMap.getKeyCodeSet();
                Integer[] keyCodes = keySet.toArray(new Integer[keySet.size()]);
                for (Integer keyCode : keyCodes) {
                    cachedMap.removeMapping(keyCode);
                }
                refreshTable();
            }
        }
    });
    maxWidth = Math.max(maxWidth, clearButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);

    gridDataButton.hint(maxWidth, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y).applyTo(addButton);
    gridDataButton.hint(maxWidth, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y).applyTo(removeButton);
    gridDataButton.hint(maxWidth, editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y).applyTo(editButton);
    gridDataButton.hint(maxWidth, clearButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y).applyTo(clearButton);

    initialize();

    return content;
}

From source file:de.fzi.skillpro.order.dialogs.CreateNewOrderDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite area = (Composite) super.createDialogArea(parent);

    Composite container = new Composite(area, SWT.NONE);
    GridLayoutFactory gridLayoutDouble = GridLayoutFactory.swtDefaults().numColumns(2);

    GridDataFactory gd = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER);
    GridDataFactory gdGrab = gd.copy().grab(true, false);

    container.setLayoutData(gdGrab.create());
    container.setLayout(gridLayoutDouble.create());
    createContainerItems(container, gdGrab);

    return area;/*from   w w  w .  java  2  s.c  o m*/
}

From source file:eu.esdihumboldt.hale.ui.functions.custom.pages.internal.CustomPropertyFunctionEntityEditor.java

License:Open Source License

@Override
protected void createControls(Composite page) {
    GridLayoutFactory.swtDefaults().numColumns(4).equalWidth(true).applyTo(page);

    GridDataFactory labelStyle = GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).grab(false, false);
    GridDataFactory fieldStyle = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false);
    GridDataFactory longFieldStyle = fieldStyle.copy().span(3, 1);
    GridDataFactory checkStyle = fieldStyle.copy().span(2, 1);

    // name/*w  w w  .  ja  v a 2 s  .  c  om*/
    Label nameLabel = new Label(page, SWT.NONE);
    nameLabel.setText("Name:");
    labelStyle.applyTo(nameLabel);
    nameText = new Text(page, SWT.SINGLE | SWT.BORDER);
    longFieldStyle.applyTo(nameText);

    // binding / type
    Label typeLabel = new Label(page, SWT.NONE);
    typeLabel.setText("Type:");
    labelStyle.applyTo(typeLabel);
    bindingOrType = new BindingOrTypeEditor(page, SchemaSpaceID.SOURCE);
    longFieldStyle.applyTo(bindingOrType.getControl());

    // min
    Label minLabel = new Label(page, SWT.NONE);
    minLabel.setText("Min:");
    labelStyle.applyTo(minLabel);
    minSpinner = new Spinner(page, SWT.BORDER);
    minSpinner.setValues(1, 0, 100, 0, 1, 10);
    fieldStyle.applyTo(minSpinner);

    // max
    Label maxLabel = new Label(page, SWT.NONE);
    maxLabel.setText("Max:");
    labelStyle.applyTo(maxLabel);
    maxSpinner = new Spinner(page, SWT.BORDER);
    maxSpinner.setValues(1, 1, 100, 0, 1, 10);
    fieldStyle.applyTo(maxSpinner);

    // eager
    eagerSelect = new Button(page, SWT.CHECK);
    eagerSelect.setText("eager");
    checkStyle.applyTo(eagerSelect);

    // unbounded
    unboundedSelect = new Button(page, SWT.CHECK);
    unboundedSelect.setText("unbounded");
    checkStyle.applyTo(unboundedSelect);
}