List of usage examples for org.eclipse.jface.databinding.swt SWTObservables observeSelection
@Deprecated public static ISWTObservableValue observeSelection(Control control)
control
. From source file:com.amazonaws.eclipse.identitymanagement.role.CreateRoleSecondPage.java
License:Apache License
private void createServiceRoleControl(Composite comp) { serviceRolesButton = new Button(comp, SWT.RADIO); serviceRolesButton.setText("AWS Service Roles"); serviceRolesButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { servicesCombo.setEnabled(true); accountIdText.setEnabled(false); internalAccountIdText.setEnabled(false); externalAccountIdText.setEnabled(false); IdentityProvidersCombo.setEnabled(false); applicationIdText.setEnabled(false); }/* www. j a v a 2s . c o m*/ public void widgetDefaultSelected(SelectionEvent e) { } }); bindingContext.bindValue(SWTObservables.observeSelection(serviceRolesButton), serviceRoles); servicesCombo = new Combo(comp, SWT.NONE); for (String service : services) { servicesCombo.add(service); } servicesCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); servicesCombo.setEnabled(false); bindingContext.bindValue(SWTObservables.observeSelection(servicesCombo), service); ChainValidator<String> serviceRoleValidationStatusProvider = new ChainValidator<String>(service, serviceRoles, new NotEmptyValidator("Please select a service")); bindingContext.addValidationStatusProvider(serviceRoleValidationStatusProvider); DataBindingUtils.addStatusDecorator(servicesCombo, serviceRoleValidationStatusProvider); }
From source file:com.amazonaws.eclipse.identitymanagement.role.CreateRoleSecondPage.java
License:Apache License
private void createAccountRoleControl(Composite comp) { accountRolesButon = new Button(comp, SWT.RADIO); accountRolesButon.setText("Provide access between AWS accounts you own"); accountRolesButon.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { servicesCombo.setEnabled(false); accountIdText.setEnabled(true); internalAccountIdText.setEnabled(false); externalAccountIdText.setEnabled(false); IdentityProvidersCombo.setEnabled(false); applicationIdText.setEnabled(false); }//from w ww . j a va2 s .co m public void widgetDefaultSelected(SelectionEvent e) { } }); bindingContext.bindValue(SWTObservables.observeSelection(accountRolesButon), accountRoles); new Label(comp, SWT.NONE).setText("Account Id:"); accountIdText = new Text(comp, SWT.BORDER); accountIdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); accountIdText.setEnabled(false); bindingContext.bindValue(SWTObservables.observeText(accountIdText, SWT.Modify), accountId); ChainValidator<String> accountIdValidationStatusProvider = new ChainValidator<String>(accountId, accountRoles, new NotEmptyValidator("Please enter your account Id")); bindingContext.addValidationStatusProvider(accountIdValidationStatusProvider); DataBindingUtils.addStatusDecorator(accountIdText, accountIdValidationStatusProvider); }
From source file:com.amazonaws.eclipse.identitymanagement.role.CreateRoleSecondPage.java
License:Apache License
private void createThirdPartyControl(Composite comp) { thirdPartyRolesButton = new Button(comp, SWT.RADIO); thirdPartyRolesButton.setText("Provide access to a 3rd party AWS account"); thirdPartyRolesButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { servicesCombo.setEnabled(false); accountIdText.setEnabled(false); IdentityProvidersCombo.setEnabled(false); applicationIdText.setEnabled(false); internalAccountIdText.setEnabled(true); externalAccountIdText.setEnabled(true); }//from w w w . j a va2 s.c o m public void widgetDefaultSelected(SelectionEvent e) { } }); bindingContext.bindValue(SWTObservables.observeSelection(thirdPartyRolesButton), thirdPartyRoles); new Label(comp, SWT.NONE).setText("Account Id:"); internalAccountIdText = new Text(comp, SWT.BORDER); internalAccountIdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); internalAccountIdText.setEnabled(false); bindingContext.bindValue(SWTObservables.observeText(internalAccountIdText, SWT.Modify), internalAccountId); ChainValidator<String> internalAccountIdValidationStatusProvider = new ChainValidator<String>( internalAccountId, thirdPartyRoles, new NotEmptyValidator("Please enter the internal account Id")); bindingContext.addValidationStatusProvider(internalAccountIdValidationStatusProvider); DataBindingUtils.addStatusDecorator(internalAccountIdText, internalAccountIdValidationStatusProvider); new Label(comp, SWT.NONE).setText("External Id:"); ; externalAccountIdText = new Text(comp, SWT.BORDER); externalAccountIdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); externalAccountIdText.setEnabled(false); bindingContext.bindValue(SWTObservables.observeText(externalAccountIdText, SWT.Modify), externalAccountId); ChainValidator<String> externalAccountIdValidationStatusProvider = new ChainValidator<String>( externalAccountId, thirdPartyRoles, new NotEmptyValidator("Please enter the external account Id")); bindingContext.addValidationStatusProvider(externalAccountIdValidationStatusProvider); DataBindingUtils.addStatusDecorator(externalAccountIdText, externalAccountIdValidationStatusProvider); }
From source file:com.amazonaws.eclipse.identitymanagement.role.CreateRoleSecondPage.java
License:Apache License
private void createWebIdentityProviderControl(Composite comp) { webFederationRolesButton = new Button(comp, SWT.RADIO); webFederationRolesButton.setText("Provide access to web identity providers"); webFederationRolesButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { servicesCombo.setEnabled(false); accountIdText.setEnabled(false); internalAccountIdText.setEnabled(false); externalAccountIdText.setEnabled(false); IdentityProvidersCombo.setEnabled(true); applicationIdText.setEnabled(true); }/*from w ww. j a va 2s .c o m*/ public void widgetDefaultSelected(SelectionEvent e) { } }); Label label = new Label(comp, SWT.NONE | SWT.WRAP); label.setText(webIdentityRoleHelpMessage); GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); gridData.widthHint = 200; label.setLayoutData(gridData); bindingContext.bindValue(SWTObservables.observeSelection(webFederationRolesButton), webProviderRoles); new Label(comp, SWT.NONE).setText("Identity Provider"); IdentityProvidersCombo = new Combo(comp, SWT.BORDER); for (String provider : IDENTITY_PROVIDERS) { IdentityProvidersCombo.add(provider); } IdentityProvidersCombo.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (IDENTITY_PROVIDERS[IdentityProvidersCombo.getSelectionIndex()].equals("Google")) { applicationIdLabel.setText("Audience"); } else { applicationIdLabel.setText("Application Id"); } } public void widgetDefaultSelected(SelectionEvent e) { } }); IdentityProvidersCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IdentityProvidersCombo.setEnabled(false); bindingContext.bindValue(SWTObservables.observeSelection(IdentityProvidersCombo), webProvider); ChainValidator<String> webProviderValidationStatusProvider = new ChainValidator<String>(webProvider, webProviderRoles, new NotEmptyValidator("Please select an identity provider")); bindingContext.addValidationStatusProvider(webProviderValidationStatusProvider); IdentityProvidersCombo.setText("Facebook"); applicationIdLabel = new Label(comp, SWT.NONE); applicationIdLabel.setText("Application Id"); applicationIdText = new Text(comp, SWT.BORDER); applicationIdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); applicationIdText.setEnabled(false); bindingContext.bindValue(SWTObservables.observeText(applicationIdText, SWT.Modify), applicationId); ChainValidator<String> applicationIdValidationStatusProvider = new ChainValidator<String>(applicationId, webProviderRoles, new NotEmptyValidator("Please enter application Id or Audience")); bindingContext.addValidationStatusProvider(applicationIdValidationStatusProvider); DataBindingUtils.addStatusDecorator(applicationIdText, applicationIdValidationStatusProvider); }
From source file:com.amazonaws.eclipse.identitymanagement.role.CreateRoleThirdPage.java
License:Apache License
public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginLeft = 5;/*from ww w .ja va 2 s .co m*/ composite.setLayout(layout); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); grantPermissionButton = new Button(composite, SWT.CHECK); grantPermissionButton.setText("Grant permissions"); grantPermissionButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (grantPermissionButton.getSelection()) { policyNameText.setEnabled(true); policyDocText.setEnabled(true); } else { policyNameText.setEnabled(false); policyDocText.setEnabled(false); } } public void widgetDefaultSelected(SelectionEvent e) { } }); bindingContext.bindValue(SWTObservables.observeSelection(grantPermissionButton), grantPermission); new Label(composite, SWT.NONE).setText("Policy Name:"); policyNameText = new Text(composite, SWT.BORDER); policyNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); bindingContext.bindValue(SWTObservables.observeText(policyNameText, SWT.Modify), policyName); ChainValidator<String> policyNameValidationStatusProvider = new ChainValidator<String>(policyName, grantPermission, new NotEmptyValidator("Please enter policy name")); bindingContext.addValidationStatusProvider(policyNameValidationStatusProvider); DataBindingUtils.addStatusDecorator(policyNameText, policyNameValidationStatusProvider); new Label(composite, SWT.NONE).setText("Policy Documentation:"); policyDocText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); GridData gridData = new GridData(GridData.FILL_BOTH); gridData.minimumHeight = 250; policyDocText.setLayoutData(gridData); bindingContext.bindValue(SWTObservables.observeText(policyDocText, SWT.Modify), policyDoc); ChainValidator<String> policyDocValidationStatusProvider = new ChainValidator<String>(policyDoc, grantPermission, new NotEmptyValidator("Please enter valid policy doc")); bindingContext.addValidationStatusProvider(policyDocValidationStatusProvider); DataBindingUtils.addStatusDecorator(policyDocText, policyDocValidationStatusProvider); Link link = new Link(composite, SWT.NONE | SWT.WRAP); link.setText("For more information about the access policy language, " + "see <a href=\"" + ConceptUrl + "\">Key Concepts</a> in Using AWS Identity and Access Management."); link.addListener(SWT.Selection, new WebLinkListener()); gridData = new GridData(SWT.FILL, SWT.TOP, true, false); gridData.widthHint = 200; link.setLayoutData(gridData); // Finally provide aggregate status reporting for the entire wizard page final AggregateValidationStatus aggregateValidationStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY); aggregateValidationStatus.addChangeListener(new IChangeListener() { public void handleChange(ChangeEvent event) { Object value = aggregateValidationStatus.getValue(); if (value instanceof IStatus == false) return; IStatus status = (IStatus) value; if (status.isOK()) { setErrorMessage(null); setMessage(OK_MESSAGE, Status.OK); } else if (status.getSeverity() == Status.WARNING) { setErrorMessage(null); setMessage(status.getMessage(), Status.WARNING); } else if (status.getSeverity() == Status.ERROR) { setErrorMessage(status.getMessage()); } setPageComplete(status.isOK()); } }); setControl(composite); }
From source file:com.amazonaws.eclipse.lambda.project.wizard.page.NewLambdaJavaFunctionProjectWizardPageOne.java
License:Open Source License
private void bindControls() { handlerPackageTextObservable = SWTObservables.observeText(handlerPackageText, SWT.Modify); bindingContext.bindValue(handlerPackageTextObservable, PojoObservables.observeValue(dataModel, P_HANDLER_PACKAGE_NAME)); handlerClassTextObservable = SWTObservables.observeText(handlerClassText, SWT.Modify); bindingContext.bindValue(handlerClassTextObservable, PojoObservables.observeValue(dataModel, P_HANDLER_CLASS_NAME)); customHandlerInputTypeTextObservable = SWTObservables.observeText(customHandlerInputTypeText, SWT.Modify); bindingContext.bindValue(customHandlerInputTypeTextObservable, PojoObservables.observeValue(dataModel, P_CUSTOM_HANDLER_INPUT_TYPE)); handlerOutputTypeTextObservable = SWTObservables.observeText(handlerOutputTypeText, SWT.Modify); bindingContext.bindValue(handlerOutputTypeTextObservable, PojoObservables.observeValue(dataModel, P_HANDLER_OUTPUT_TYPE)); showReadmeFileCheckboxObservable = SWTObservables.observeSelection(showReadmeFileCheckbox); bindingContext.bindValue(showReadmeFileCheckboxObservable, PojoObservables.observeValue(dataModel, P_SHOW_README_FILE)); }
From source file:com.amazonaws.eclipse.lambda.project.wizard.page.NewServerlessProjectWizardPageOne.java
License:Open Source License
private void createSelectServerlessTemplateButtonSection(Composite parent) { selectServerlessTemplateButton = new Button(parent, SWT.RADIO); selectServerlessTemplateButton.setText("Select a Serverless template file:"); selectServerlessTemplateButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { onSelectServerlessTemplateButtonSelect(); }//from w w w .j a va 2s . co m }); selectServerlessTemplateButtonObservable = SWTObservables.observeSelection(selectServerlessTemplateButton); }
From source file:com.amazonaws.eclipse.lambda.project.wizard.util.LambdaFunctionGroup.java
License:Open Source License
public void createShowReadmeFileCheckBox() { showReadmeFileCheckbox = newCheckbox(parentComposite, "Show README guide after creating the project", 1); showReadmeFileCheckboxObservable = SWTObservables.observeSelection(showReadmeFileCheckbox); bindingContext.bindValue(showReadmeFileCheckboxObservable, PojoObservables.observeValue(dataModel, P_SHOW_README_FILE)); }
From source file:com.amazonaws.eclipse.lambda.serverless.ui.DeployServerlessProjectPage.java
License:Open Source License
private void createS3BucketSection(Composite parent) { Group group = newGroup(parent, "Select or Create S3 Bucket for Your Function Code"); group.setLayout(createSectionGroupLayout()); newLabel(group, "S3 Bucket Name:"); Composite composite = new Composite(group, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); gridData.horizontalSpan = 2;/*from w ww . j a va 2 s . c o m*/ composite.setLayoutData(gridData); composite.setLayout(new GridLayout(2, false)); bucketNameCombo = newCombo(composite, 1); bucketNameCombo.setEnabled(false); bucketNameCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { LambdaAnalytics.trackS3BucketComboSelectionChange(); } }); bucketNameComboObservable = SWTObservables.observeSelection(bucketNameCombo); bucketNameModelObservable = PojoObservables.observeValue(dataModel, DeployServerlessProjectDataModel.P_BUCKET_NAME); bindingContext.bindValue(bucketNameComboObservable, bucketNameModelObservable); createBucketButton = new Button(composite, SWT.PUSH); createBucketButton.setText("Create"); createBucketButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { LambdaAnalytics.trackClickCreateNewBucketButton(); CreateS3BucketDialog dialog = new CreateS3BucketDialog(Display.getCurrent().getActiveShell(), dataModel.getRegion()); int returnCode = dialog.open(); if (returnCode == 0) { String bucketName = dialog.getCreatedBucketName(); if (bucketNameLoadedObservable.getValue().equals(Boolean.TRUE)) { bucketNameCombo.add(bucketName); bucketNameCombo.select(bucketNameCombo.getItemCount() - 1); } else { CancelableThread.cancelThread(loadS3BucketsInFunctionRegionThread); bucketNameLoadedObservable.setValue(true); bucketNameCombo.setItems(new String[] { bucketName }); bucketNameCombo.setEnabled(true); bucketNameCombo.select(0); updateUIDataToModel(); } } } }); }
From source file:com.amazonaws.eclipse.lambda.upload.wizard.page.FunctionConfigurationComposite.java
License:Open Source License
private void bindControls() { FunctionConfigPageDataModel createModel = dataModel.getFunctionConfigPageDataModel(); descriptionTextObservable = SWTObservables.observeText(descriptionText, SWT.Modify); descriptionModelObservable = PojoObservables.observeValue(createModel, FunctionConfigPageDataModel.P_DESCRIPTION); bindingContext.bindValue(descriptionTextObservable, descriptionModelObservable); handlerComboObservable = SWTObservables.observeSelection(handlerCombo); handlerModelObservable = PojoObservables.observeValue(createModel, FunctionConfigPageDataModel.P_HANDLER); bindingContext.bindValue(handlerComboObservable, handlerModelObservable); bucketNameComboObservable = SWTObservables.observeSelection(bucketNameCombo); bucketNameModelObservable = PojoObservables.observeValue(createModel, FunctionConfigPageDataModel.P_BUCKET_NAME); bindingContext.bindValue(bucketNameComboObservable, bucketNameModelObservable); memoryTextObservable = SWTObservables.observeText(memoryText, SWT.Modify); memoryModelObservable = PojoObservables.observeValue(createModel, FunctionConfigPageDataModel.P_MEMORY); bindingContext.bindValue(memoryTextObservable, memoryModelObservable); timeoutTextObservable = SWTObservables.observeText(timeoutText, SWT.Modify); timeoutModelObservable = PojoObservables.observeValue(createModel, FunctionConfigPageDataModel.P_TIMEOUT); bindingContext.bindValue(timeoutTextObservable, timeoutModelObservable); }