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

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

Introduction

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

Prototype

public void applyTo(Control control) 

Source Link

Document

Sets the layout data on the given control.

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  www. j ava 2s .  com*/

    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  w  w  w.  j  a  v a2s . c  om*/

    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.cloudfront.AbstractDistributionEditor.java

License:Apache License

protected void createDistributionSummaryComposite(FormToolkit toolkit, Composite parent) {
    GridDataFactory gdf = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false);

    GridDataFactory sectionGDF = GridDataFactory.swtDefaults().span(2, 1).grab(true, false)
            .align(SWT.FILL, SWT.TOP).indent(0, 10);

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

    toolkit.createLabel(summaryComposite, "Domain Name:");

    domainNameText = createText(summaryComposite);
    gdf.applyTo(domainNameText);

    toolkit.createLabel(summaryComposite, "Distribution ID:");
    distributionIdText = createText(summaryComposite);
    gdf.applyTo(distributionIdText);/*from   ww w  . j  a v a2 s  . c o  m*/

    toolkit.createLabel(summaryComposite, "Origin:");
    originText = createText(summaryComposite);
    gdf.applyTo(originText);

    toolkit.createLabel(summaryComposite, "Enabled:");
    enabledText = createText(summaryComposite);
    gdf.applyTo(enabledText);

    toolkit.createLabel(summaryComposite, "Status:");
    statusText = createText(summaryComposite);
    gdf.applyTo(statusText);

    toolkit.createLabel(summaryComposite, "Last Modified:");
    lastModifiedText = createText(summaryComposite);
    gdf.applyTo(lastModifiedText);

    toolkit.createLabel(summaryComposite, "Comment:");
    commentText = createText(summaryComposite);
    gdf.applyTo(commentText);

    if (supportsSpecificProtocols()) {
        toolkit.createLabel(summaryComposite, "Supported Protocols:");
        requiredProtocolsLabel = toolkit.createLabel(summaryComposite, "");
        gdf.applyTo(requiredProtocolsLabel);
    }

    if (supportsDefaultRootObjects()) {
        toolkit.createLabel(summaryComposite, "Default Root Object:");
        defaultRootObjectLabel = toolkit.createLabel(summaryComposite, "");
        gdf.applyTo(defaultRootObjectLabel);
    }

    // Logging
    Section loggingSection = toolkit.createSection(summaryComposite, Section.EXPANDED | Section.TITLE_BAR);
    loggingSection.setText("Access Logging:");
    Composite loggingComposite = toolkit.createComposite(loggingSection);
    loggingSection.setClient(loggingComposite);
    loggingComposite.setLayout(new GridLayout(2, false));
    sectionGDF.applyTo(loggingSection);

    toolkit.createLabel(loggingComposite, "Logging Enabled:");
    loggingEnabledText = createText(loggingComposite);

    toolkit.createLabel(loggingComposite, "Destination Bucket:");
    loggingBucketText = createText(loggingComposite);
    gdf.applyTo(loggingBucketText);

    toolkit.createLabel(loggingComposite, "Log File Prefix:");
    loggingPrefixText = createText(loggingComposite);
    gdf.applyTo(loggingPrefixText);

    WebLinkListener webLinkListener = new WebLinkListener();
    createVerticalSpacer(loggingComposite);
    createLink(loggingComposite, webLinkListener,
            "Amazon CloudFront provides optional log files with information about end user access to your objects.");
    createLink(loggingComposite, webLinkListener,
            "For more information, see the <A HREF=\"" + ACCESS_LOGGING_DOCUMENTATION_URL
                    + "\">Access Logs for Distributions</A> section in the Amazon CloudFront documentation.");

    // CNAMEs
    Section cnamesSection = toolkit.createSection(summaryComposite, Section.EXPANDED | Section.TITLE_BAR);
    Composite cnamesComposite = toolkit.createComposite(cnamesSection);
    cnamesSection.setClient(cnamesComposite);
    sectionGDF.applyTo(cnamesSection);
    cnamesSection.setText("CNAME Aliases:");
    cnamesComposite.setLayout(new GridLayout(2, false));

    cnamesList = new org.eclipse.swt.widgets.List(cnamesComposite, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL);
    gdf.applyTo(cnamesList);
    ((GridData) cnamesList.getLayoutData()).horizontalSpan = 2;

    createVerticalSpacer(cnamesComposite);

    createLink(cnamesComposite, webLinkListener,
            "A CNAME record lets you specify an alternate domain name for the domain name CloudFront provides for your distribution.");
    createLink(cnamesComposite, webLinkListener,
            "For more information, see the <A HREF=\"" + CNAME_DOCUMENTATION_URL
                    + "\">Using CNAMEs with Distributions</A> section in the Amazon CloudFront documentation.");
}

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   w  w  w. j  a  v  a  2s .co  m*/

    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.explorer.sns.TopicEditor.java

License:Apache License

private void createTopicSummaryComposite(FormToolkit toolkit, Composite parent) {
    GridDataFactory gdf = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false);

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

    toolkit.createLabel(summaryComposite, "Owner ID:");
    ownerLabel = toolkit.createLabel(summaryComposite, "");
    gdf.applyTo(ownerLabel);

    toolkit.createLabel(summaryComposite, "Pending Subscriptions:");
    pendingSubscriptionsLabel = toolkit.createLabel(summaryComposite, "");
    gdf.applyTo(pendingSubscriptionsLabel);

    toolkit.createLabel(summaryComposite, "Confirmed Subscriptions:");
    confirmedSubscriptionsLabel = toolkit.createLabel(summaryComposite, "");
    gdf.applyTo(confirmedSubscriptionsLabel);

    toolkit.createLabel(summaryComposite, "Deleted Subscriptions:");
    deletedSubscriptionsLabel = toolkit.createLabel(summaryComposite, "");
    gdf.applyTo(deletedSubscriptionsLabel);

    toolkit.createLabel(summaryComposite, "Display Name:");
    displayNameLabel = toolkit.createLabel(summaryComposite, "");
    gdf.applyTo(displayNameLabel);//from www  .ja v  a 2s.  c om

    toolkit.createLabel(summaryComposite, "Topic ARN:");
    topicArnLabel = toolkit.createLabel(summaryComposite, "");
    gdf.applyTo(topicArnLabel);

    new LoadTopicAttributesThread().start();
}

From source file:com.amazonaws.eclipse.explorer.sqs.QueueEditor.java

License:Apache License

private void createQueueSummaryInfoSection(final ScrolledForm form, final 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(form.getBody());
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    toolkit.createLabel(composite, "Retention Period:");
    retentionPeriodLabel = toolkit.createLabel(composite, "");
    gridDataFactory.applyTo(retentionPeriodLabel);

    toolkit.createLabel(composite, "Max Message Size:", SWT.BORDER);
    maxMessageSizeLabel = toolkit.createLabel(composite, "", SWT.BORDER);
    gridDataFactory.applyTo(maxMessageSizeLabel);

    toolkit.createLabel(composite, "Created:");
    createdLabel = toolkit.createLabel(composite, "");
    gridDataFactory.applyTo(createdLabel);

    toolkit.createLabel(composite, "Visibility Timeout:");
    visibilityTimeoutLabel = toolkit.createLabel(composite, "");
    gridDataFactory.applyTo(visibilityTimeoutLabel);

    toolkit.createLabel(composite, "Queue ARN:");
    queueArnLabel = toolkit.createLabel(composite, "");
    gridDataFactory.applyTo(queueArnLabel);

    toolkit.createLabel(composite, "Approx. Message Count:");
    numberOfMessagesLabel = toolkit.createLabel(composite, "");
    gridDataFactory.applyTo(numberOfMessagesLabel);

    new LoadQueueAttributesThread().start();
}

From source file:com.amazonaws.eclipse.identitymanagement.group.GroupSummary.java

License:Apache License

public GroupSummary(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, "Group ARN:");
    groupARNLable = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(groupARNLable);

    toolkit.createLabel(this, "Users:");
    usersInGroupLabel = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(usersInGroupLabel);

    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);

}

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 .jav  a2s.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.UserSummary.java

License:Apache License

public UserSummary(final AmazonIdentityManagement iam, Composite parent, final FormToolkit toolkit) {
    super(parent, SWT.NONE);
    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, "User ARN:");
    userARNLable = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(userARNLable);

    toolkit.createLabel(this, "Groups:");
    groupsLabel = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(groupsLabel);

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

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

    toolkit.createLabel(this, "Has Password:");
    havePasswordLabel = toolkit.createText(this, "", SWT.READ_ONLY | SWT.NONE);
    gridDataFactory.applyTo(havePasswordLabel);

    removePasswordButton = toolkit.createButton(this, "Remove Password", SWT.PUSH);
    removePasswordButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            new Job("Remove password") {

                @Override
                protected IStatus run(IProgressMonitor monitor) {
                    try {
                        removePassword();
                        refresh();
                        return Status.OK_STATUS;
                    } catch (Exception e) {
                        return new Status(Status.ERROR, AwsToolkitCore.PLUGIN_ID,
                                "Unable to delete the password: " + e.getMessage(), e);
                    }
                }

            }.schedule();
        }

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

    removePasswordButton.setEnabled(false);
    updatePassowrdButton = toolkit.createButton(this, "Update Password", SWT.PUSH);
    updatePassowrdButton.setEnabled(false);
    updatePassowrdButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            new UpdatePasswordDialog(iam, UserSummary.this, Display.getCurrent().getActiveShell(), toolkit,
                    user, hasPassword).open();
        }

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

    manageAccessKeysButton = toolkit.createButton(this, "Manage Access Keys", SWT.PUSH);
    manageAccessKeysButton.addSelectionListener((new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            new UserCredentialManagementDialog(iam, Display.getCurrent().getActiveShell(), user.getUserName())
                    .open();
        }

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

    manageAccessKeysButton.setEnabled(false);

    this.iam = iam;

}