List of usage examples for org.eclipse.jface.databinding.swt SWTObservables observeText
@Deprecated public static ISWTObservableValue observeText(Control control, int event)
control
. From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.DeployWizardEnvironmentConfigPage.java
License:Apache License
private void createSSLCertControls(Composite composite) { newLabel(composite, "SSL certificate Id"); Text text = newText(composite, ""); sslCertObservable = SWTObservables.observeText(text, SWT.Modify); }
From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.DeployWizardEnvironmentConfigPage.java
License:Apache License
private void createHealthCheckURLControls(Composite composite) { newLabel(composite, "Application health check URL"); Text text = newText(composite, "/"); healthCheckURLObservable = SWTObservables.observeText(text, SWT.Modify); }
From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.DeployWizardEnvironmentConfigPage.java
License:Apache License
private void createSNSTopicControls(Composite composite) { newLabel(composite, "Email address for notifications"); Text text = newText(composite, ""); snsTopicObservable = SWTObservables.observeText(text, SWT.Modify); }
From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.DeployWizardEnvironmentConfigPage.java
License:Apache License
/** * Creates validation bindings for the controls on this page. *//*from w w w . java 2s. co m*/ private void bindControls() { initializeValidators(); // Key pair usingKeyPairObservable = SWTObservables.observeSelection(usingKeyPair); bindingContext.bindValue(usingKeyPairObservable, PojoObservables.observeValue(wizardDataModel, DeployWizardDataModel.USING_KEY_PAIR), null, null); IViewerObservableValue keyPairSelectionObservable = ViewersObservables .observeSingleSelection(keyPairComposite.getViewer()); bindingContext.bindValue(keyPairSelectionObservable, PojoObservables.observeValue(wizardDataModel, DeployWizardDataModel.KEY_PAIR), null, null); ChainValidator<String> keyPairValidator = new ChainValidator<String>(keyPairSelectionObservable, usingKeyPairObservable, new ValidKeyPairValidator(AwsToolkitCore.getDefault().getCurrentAccountId())); bindingContext.addValidationStatusProvider(keyPairValidator); usingCnameObservable = SWTObservables.observeSelection(usingCnameButton); bindingContext.bindValue(usingCnameObservable, PojoObservables.observeValue(wizardDataModel, DeployWizardDataModel.USING_CNAME), null, null) .updateTargetToModel(); bindingContext .bindValue(SWTObservables.observeText(cname, SWT.Modify), PojoObservables.observeValue(wizardDataModel, DeployWizardDataModel.CNAME), null, null) .updateTargetToModel(); // SSL cert bindingContext.bindValue(sslCertObservable, PojoObservables.observeValue(wizardDataModel, DeployWizardDataModel.SSL_CERTIFICATE_ID)); // CNAME // TODO: make CNAME conform to exact spec, check for in-use ChainValidator<String> chainValidator = new ChainValidator<String>( SWTObservables.observeText(cname, SWT.Modify), usingCnameObservable, new NotEmptyValidator("CNAME cannot be empty."), new NoInvalidNameCharactersValidator("Invalid characters in CNAME.")); bindingContext.addValidationStatusProvider(chainValidator); ControlDecoration cnameDecoration = newControlDecoration(cname, "Enter a CNAME to launch your server"); new DecorationChangeListener(cnameDecoration, chainValidator.getValidationStatus()); // Health check URL bindingContext.bindValue(healthCheckURLObservable, PojoObservables.observeValue(wizardDataModel, DeployWizardDataModel.HEALTH_CHECK_URL)); // SNS topic bindingContext.bindValue(snsTopicObservable, PojoObservables.observeValue(wizardDataModel, DeployWizardDataModel.SNS_ENDPOINT)); }
From source file:com.amazonaws.eclipse.elasticbeanstalk.webproject.JavaWebProjectWizardPage.java
License:Open Source License
@SuppressWarnings("static-access") private void bindControls() { UpdateValueStrategy projectNameUpdateStrategy = new UpdateValueStrategy(); projectNameUpdateStrategy.setAfterConvertValidator(new NewProjectNameValidator()); bindingContext.bindValue(SWTObservables.observeText(projectNameText, SWT.Modify), PojoObservables.observeValue(dataModel, dataModel.PROJECT_NAME), projectNameUpdateStrategy, null); final IObservableValue accountId = new WritableValue(); accountId.setValue(dataModel.getAccountId()); accountSelectionComposite.addSelectionListener(new SelectionAdapter() { @Override// ww w . j a va 2 s .co m public void widgetSelected(SelectionEvent e) { accountId.setValue(accountSelectionComposite.getSelectedAccountId()); } }); bindingContext.bindValue(accountId, PojoObservables.observeValue(dataModel, dataModel.ACCOUNT_ID), new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)); bindingContext.bindValue(SWTObservables.observeSelection(travelLogRadioButton), PojoObservables.observeValue(dataModel, dataModel.SAMPLE_APP_INCLUDED), null, null); }
From source file:com.amazonaws.eclipse.explorer.cloudformation.wizard.CreateStackWizardFirstPage.java
License:Apache License
private void createStackNameControl(final Composite comp, int fieldDecorationWidth) { // Whether the user already set the stack name. boolean stackNameExists = false; new Label(comp, SWT.READ_ONLY).setText("Stack Name: "); Control stackNameControl = null; if (wizard.getDataModel().getMode() == Mode.Create) { Text stackNameText = new Text(comp, SWT.BORDER); bindingContext.bindValue(SWTObservables.observeText(stackNameText, SWT.Modify), stackName) .updateTargetToModel();//from w w w . ja v a 2s.c o m stackNameControl = stackNameText; } else { Combo combo = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); if (stackName.getValue() != null) { combo.setItems(new String[] { (String) stackName.getValue() }); stackNameExists = true; } else { combo.setItems(new String[] { LOADING_STACKS }); } combo.select(0); bindingContext.bindValue(SWTObservables.observeSelection(combo), stackName).updateTargetToModel(); stackNameControl = combo; stackName.addChangeListener(new IChangeListener() { public void handleChange(ChangeEvent event) { if ((Boolean) useTemplateFile.getValue()) { validateTemplateFile((String) templateFile.getValue()); } else { validateTemplateUrl((String) templateUrl.getValue()); } } }); if (!stackNameExists) { loadStackNames(combo); } } GridDataFactory.fillDefaults().grab(true, false).span(2, 1).indent(fieldDecorationWidth, 0) .applyTo(stackNameControl); ChainValidator<String> stackNameValidationStatusProvider = new ChainValidator<String>(stackName, new NotEmptyValidator("Please provide a stack name")); bindingContext.addValidationStatusProvider(stackNameValidationStatusProvider); addStatusDecorator(stackNameControl, stackNameValidationStatusProvider); }
From source file:com.amazonaws.eclipse.explorer.cloudformation.wizard.CreateStackWizardFirstPage.java
License:Apache License
private void createTemplateUrlControl(Group stackTemplateSourceGroup, int fieldDecorationWidth) { final Button templateUrlOption = new Button(stackTemplateSourceGroup, SWT.RADIO); templateUrlOption.setText("Template URL: "); templateURLText = new Text(stackTemplateSourceGroup, SWT.BORDER); templateURLText.setEnabled(false);//from www .j a v a 2s.c o m GridDataFactory.fillDefaults().grab(true, false).indent(fieldDecorationWidth, 0).applyTo(templateURLText); Link link = new Link(stackTemplateSourceGroup, SWT.None); String sampleUrl = "http://docs.aws.amazon.com/cloudformation/aws-cloudformation-templates/"; // TODO: this should really live in the regions file, not hardcoded here Region currentRegion = RegionUtils.getCurrentRegion(); if (currentRegion.getId().equals("us-east-1")) { sampleUrl = "http://docs.aws.amazon.com/cloudformation/aws-cloudformation-templates/"; } else { sampleUrl = "http://docs.aws.amazon.com/cloudformation/aws-cloudformation-templates/aws-cloudformation-templates-" + currentRegion.getId() + "/"; } link.setText("<a href=\"" + sampleUrl + "\">Browse for samples</a>"); link.addListener(SWT.Selection, new WebLinkListener()); bindingContext.bindValue(SWTObservables.observeText(templateURLText, SWT.Modify), templateUrl) .updateTargetToModel(); bindingContext.bindValue(SWTObservables.observeSelection(templateUrlOption), useTemplateUrl) .updateTargetToModel(); ChainValidator<String> templateUrlValidationStatusProvider = new ChainValidator<String>(templateUrl, useTemplateUrl, new NotEmptyValidator("Please provide a valid URL for your template")); bindingContext.addValidationStatusProvider(templateUrlValidationStatusProvider); addStatusDecorator(templateURLText, templateUrlValidationStatusProvider); templateUrlOption.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean selected = templateUrlOption.getSelection(); templateURLText.setEnabled(selected); } }); }
From source file:com.amazonaws.eclipse.explorer.cloudformation.wizard.CreateStackWizardFirstPage.java
License:Apache License
private void createTemplateFileControl(Group stackTemplateSourceGroup, int fieldDecorationWidth) { Button fileTemplateOption = new Button(stackTemplateSourceGroup, SWT.RADIO); fileTemplateOption.setText("Template File: "); fileTemplateOption.setSelection(true); fileTemplateText = new Text(stackTemplateSourceGroup, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.fillDefaults().grab(true, false).indent(fieldDecorationWidth, 0).applyTo(fileTemplateText); Button browseButton = new Button(stackTemplateSourceGroup, SWT.PUSH); browseButton.setText("Browse..."); Listener fileTemplateSelectionListener = new Listener() { public void handleEvent(Event event) { if ((Boolean) useTemplateFile.getValue()) { FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); String result = dialog.open(); if (result != null) { fileTemplateText.setText(result); }//from ww w . j a v a 2 s.com } } }; browseButton.addListener(SWT.Selection, fileTemplateSelectionListener); fileTemplateText.addListener(SWT.MouseUp, fileTemplateSelectionListener); bindingContext.bindValue(SWTObservables.observeSelection(fileTemplateOption), useTemplateFile) .updateTargetToModel(); bindingContext.bindValue(SWTObservables.observeText(fileTemplateText, SWT.Modify), templateFile) .updateTargetToModel(); ChainValidator<String> templateFileValidationStatusProvider = new ChainValidator<String>(templateFile, useTemplateFile, new NotEmptyValidator("Please provide a valid file for your template")); bindingContext.addValidationStatusProvider(templateFileValidationStatusProvider); addStatusDecorator(fileTemplateText, templateFileValidationStatusProvider); }
From source file:com.amazonaws.eclipse.explorer.cloudformation.wizard.CreateStackWizardSecondPage.java
License:Apache License
@SuppressWarnings({ "rawtypes", "unchecked" }) private void createParameterSection(Composite comp, TemplateParameter param) { Map parameterMap = (Map) wizard.getDataModel().getTemplate().get("Parameters"); // Unfortunately, we have to manually adjust for field decorations FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR); int fieldDecorationWidth = fieldDecoration.getImage().getBounds().width; Control paramControl = null;/*from w w w. ja va2s.com*/ ISWTObservableValue observeParameter = null; ChainValidator<String> validationStatusProvider = null; if (parameterMap.containsKey(param.getParameterKey())) { Label label = new Label(comp, SWT.None); label.setText(param.getParameterKey()); Map paramMap = (Map) parameterMap.get(param.getParameterKey()); // Update the default value in the model. if (wizard.getDataModel().getParameterValues().get(param.getParameterKey()) == null) { wizard.getDataModel().getParameterValues().put(param.getParameterKey(), param.getDefaultValue()); } // If the template enumerates allowed values, present them as a // combo drop down if (paramMap.containsKey(ALLOWED_VALUES)) { Combo combo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY); Collection<String> allowedValues = (Collection<String>) paramMap.get(ALLOWED_VALUES); GridDataFactory.fillDefaults().grab(true, false).indent(fieldDecorationWidth, 0).applyTo(combo); combo.setItems(allowedValues.toArray(new String[allowedValues.size()])); observeParameter = SWTObservables.observeSelection(combo); paramControl = combo; } else { // Otherwise, just use a text field with validation constraints Text text = new Text(comp, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).indent(fieldDecorationWidth, 0).applyTo(text); observeParameter = SWTObservables.observeText(text, SWT.Modify); paramControl = text; // Add validators for the constraints listed in the template List<IValidator> validators = new ArrayList<IValidator>(); validators.add(new NotEmptyValidator("Please enter a value for " + param.getParameterKey())); if (paramMap.containsKey(ALLOWED_PATTERN)) { String pattern = (String) paramMap.get(ALLOWED_PATTERN); Pattern p = Pattern.compile(pattern); validators.add(new PatternValidator(p, param.getParameterKey() + ": " + (String) paramMap.get(CONSTRAINT_DESCRIPTION))); } if (paramMap.containsKey(MIN_LENGTH)) { validators.add(new MinLengthValidator(Integer.parseInt((String) paramMap.get(MIN_LENGTH)), param.getParameterKey())); } if (paramMap.containsKey(MAX_LENGTH)) { validators.add(new MaxLengthValidator(Integer.parseInt((String) paramMap.get(MAX_LENGTH)), param.getParameterKey())); } if (paramMap.containsKey(MIN_VALUE)) { validators.add(new MinValueValidator(Integer.parseInt((String) paramMap.get(MIN_VALUE)), param.getParameterKey())); } if (paramMap.containsKey(MAX_VALUE)) { validators.add(new MaxValueValidator(Integer.parseInt((String) paramMap.get(MAX_VALUE)), param.getParameterKey())); } if (!validators.isEmpty()) { validationStatusProvider = new ChainValidator<String>(observeParameter, validators.toArray(new IValidator[validators.size()])); } } } else { AwsToolkitCore.getDefault().logException("No parameter map object found for " + param.getParameterKey(), null); return; } if (param.getDescription() != null) { Label description = new Label(comp, SWT.WRAP); GridDataFactory.fillDefaults().grab(true, false).span(2, 1).indent(0, -8).applyTo(description); description.setText(param.getDescription()); description.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)); } bindingContext.bindValue(observeParameter, Observables.observeMapEntry( wizard.getDataModel().getParameterValues(), param.getParameterKey(), String.class)); if (validationStatusProvider != null) { bindingContext.addValidationStatusProvider(validationStatusProvider); ControlDecoration decoration = new ControlDecoration(paramControl, SWT.TOP | SWT.LEFT); decoration.setDescriptionText("Invalid value"); decoration.setImage(fieldDecoration.getImage()); new DecorationChangeListener(decoration, validationStatusProvider.getValidationStatus()); } }
From source file:com.amazonaws.eclipse.explorer.dynamodb.AddGSIDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); composite.setLayout(new GridLayout()); composite = new Composite(composite, SWT.NULL); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); composite.setLayout(new GridLayout(2, false)); // Index hash key attribute name Group indexHashKeyGroup = CreateTablePageUtil.newGroup(composite, "Index Hash Key", 2); new Label(indexHashKeyGroup, SWT.NONE | SWT.READ_ONLY).setText("Index Hash Key Name:"); indexHashKeyNameText = new Text(indexHashKeyGroup, SWT.BORDER); bindingContext.bindValue(SWTObservables.observeText(indexHashKeyNameText, SWT.Modify), indexHashKeyNameInKeySchemaDefinitionModel); ChainValidator<String> indexHashKeyNameValidationStatusProvider = new ChainValidator<String>( indexHashKeyNameInKeySchemaDefinitionModel, new NotEmptyValidator("Please provide the index hash key name")); bindingContext.addValidationStatusProvider(indexHashKeyNameValidationStatusProvider); bindingContext.bindValue(SWTObservables.observeText(indexHashKeyNameText, SWT.Modify), indexHashKeyNameInAttributeDefinitionsModel); indexHashKeyNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (primaryKeyTypes.containsKey(indexHashKeyNameText.getText()) && indexHashKeyAttributeTypeCombo != null && primaryKeyTypes.get(indexHashKeyNameText.getText()) > -1) { indexHashKeyAttributeTypeCombo.select(primaryKeyTypes.get(indexHashKeyNameText.getText())); indexHashKeyAttributeTypeCombo.setEnabled(false); } else if (indexHashKeyAttributeTypeCombo != null) { indexHashKeyAttributeTypeCombo.setEnabled(true); }//from w w w.j a va 2 s . c o m } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(indexHashKeyNameText); // Index hash key attribute type new Label(indexHashKeyGroup, SWT.NONE | SWT.READ_ONLY).setText("Index Hash Key Type:"); indexHashKeyAttributeTypeCombo = new Combo(indexHashKeyGroup, SWT.DROP_DOWN | SWT.READ_ONLY); indexHashKeyAttributeTypeCombo.setItems(DATA_TYPE_STRINGS); indexHashKeyAttributeTypeCombo.select(0); bindingContext.bindValue(SWTObservables.observeSelection(indexHashKeyAttributeTypeCombo), indexHashKeyAttributeTypeModel); Group indexRangeKeyGroup = CreateTablePageUtil.newGroup(composite, "Index Range Key", 2); // Enable index range key button enableIndexRangeKeyButton = new Button(indexRangeKeyGroup, SWT.CHECK); enableIndexRangeKeyButton.setText("Enable Index Range Key"); GridDataFactory.fillDefaults().span(2, 1).applyTo(enableIndexRangeKeyButton); bindingContext.bindValue(SWTObservables.observeSelection(enableIndexRangeKeyButton), enableIndexRangeKeyModel); // Index range key attribute name final Label indexRangeKeyAttributeLabel = new Label(indexRangeKeyGroup, SWT.NONE | SWT.READ_ONLY); indexRangeKeyAttributeLabel.setText("Index Range Key Name:"); indexRangeKeyNameText = new Text(indexRangeKeyGroup, SWT.BORDER); bindingContext.bindValue(SWTObservables.observeText(indexRangeKeyNameText, SWT.Modify), indexRangeKeyNameInKeySchemaDefinitionModel); ChainValidator<String> indexRangeKeyNameValidationStatusProvider = new ChainValidator<String>( indexRangeKeyNameInKeySchemaDefinitionModel, enableIndexRangeKeyModel, new NotEmptyValidator("Please provide the index range key name")); bindingContext.addValidationStatusProvider(indexRangeKeyNameValidationStatusProvider); bindingContext.bindValue(SWTObservables.observeText(indexRangeKeyNameText, SWT.Modify), indexRangeKeyNameInAttributeDefinitionsModel); indexRangeKeyNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (primaryKeyTypes.containsKey(indexRangeKeyNameText.getText()) && indexRangeKeyAttributeTypeCombo != null && primaryKeyTypes.get(indexRangeKeyNameText.getText()) > -1) { indexRangeKeyAttributeTypeCombo.select(primaryKeyTypes.get(indexRangeKeyNameText.getText())); indexRangeKeyAttributeTypeCombo.setEnabled(false); } else if (indexRangeKeyAttributeTypeCombo != null) { indexRangeKeyAttributeTypeCombo.setEnabled(true); } } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(indexRangeKeyNameText); // Index range key attribute type final Label indexRangeKeyTypeLabel = new Label(indexRangeKeyGroup, SWT.NONE | SWT.READ_ONLY); indexRangeKeyTypeLabel.setText("Index Range Key Type:"); indexRangeKeyAttributeTypeCombo = new Combo(indexRangeKeyGroup, SWT.DROP_DOWN | SWT.READ_ONLY); indexRangeKeyAttributeTypeCombo.setItems(DATA_TYPE_STRINGS); indexRangeKeyAttributeTypeCombo.select(0); bindingContext.bindValue(SWTObservables.observeSelection(indexRangeKeyAttributeTypeCombo), indexRangeKeyAttributeTypeModel); enableIndexRangeKeyButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { enableIndexRangeKey = enableIndexRangeKeyButton.getSelection(); indexRangeKeyAttributeLabel.setEnabled(enableIndexRangeKey); indexRangeKeyNameText.setEnabled(enableIndexRangeKey); indexRangeKeyTypeLabel.setEnabled(enableIndexRangeKey); indexRangeKeyAttributeTypeCombo.setEnabled(enableIndexRangeKey); } }); enableIndexRangeKeyButton.setSelection(false); indexRangeKeyAttributeLabel.setEnabled(false); indexRangeKeyNameText.setEnabled(false); indexRangeKeyTypeLabel.setEnabled(false); indexRangeKeyAttributeTypeCombo.setEnabled(false); // Index name Label indexNameLabel = new Label(composite, SWT.NONE | SWT.READ_ONLY); indexNameLabel.setText("Index Name:"); indexNameText = new Text(composite, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(indexNameText); bindingContext.bindValue(SWTObservables.observeText(indexNameText, SWT.Modify), indexNameModel); ChainValidator<String> indexNameValidationStatusProvider = new ChainValidator<String>(indexNameModel, new NotEmptyValidator("Please provide an index name")); bindingContext.addValidationStatusProvider(indexNameValidationStatusProvider); // Projection type new Label(composite, SWT.NONE | SWT.READ_ONLY).setText("Projected Attributes:"); projectionTypeCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); projectionTypeCombo.setItems(PROJECTED_ATTRIBUTES); projectionTypeCombo.select(0); bindingContext.bindValue(SWTObservables.observeSelection(projectionTypeCombo), projectionTypeModel); projectionTypeCombo.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (projectionTypeCombo.getSelectionIndex() == 2) { // Enable the list for adding non-key attributes to the projection addAttributeButton.setEnabled(true); } else { addAttributeButton.setEnabled(false); } } public void widgetDefaultSelected(SelectionEvent e) { } }); // Non-key attributes in the projection final AttributeList attributeList = new AttributeList(composite); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, SWT.DEFAULT).applyTo(attributeList); addAttributeButton = new Button(composite, SWT.PUSH); addAttributeButton.setText("Add Attribute"); addAttributeButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); addAttributeButton.setImage(AwsToolkitCore.getDefault().getImageRegistry().get(AwsToolkitCore.IMAGE_ADD)); addAttributeButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { AddNewAttributeDialog newAttributeTable = new AddNewAttributeDialog(); if (newAttributeTable.open() == 0) { // lazy-initialize the list if (null == globalSecondaryIndex.getProjection().getNonKeyAttributes()) { globalSecondaryIndex.getProjection().setNonKeyAttributes(new LinkedList<String>()); } globalSecondaryIndex.getProjection().getNonKeyAttributes() .add(newAttributeTable.getNewAttributeName()); attributeList.refresh(); } } public void widgetDefaultSelected(SelectionEvent e) { } }); addAttributeButton.setEnabled(false); // GSI throughput FontData[] fontData = indexNameLabel.getFont().getFontData(); for (FontData fd : fontData) { fd.setStyle(SWT.ITALIC); } italicFont = new Font(Display.getDefault(), fontData); Group throughputGroup = CreateTablePageUtil.newGroup(composite, "Global Secondary Index Throughput", 3); new Label(throughputGroup, SWT.READ_ONLY).setText("Read Capacity Units:"); final Text readCapacityText = CreateTablePageUtil.newTextField(throughputGroup); readCapacityText.setText("" + CAPACITY_UNIT_MINIMUM); bindingContext.bindValue(SWTObservables.observeText(readCapacityText, SWT.Modify), readCapacityModel); ChainValidator<Long> readCapacityValidationStatusProvider = new ChainValidator<Long>(readCapacityModel, new RangeValidator("Please enter a read capacity of " + CAPACITY_UNIT_MINIMUM + " or more.", CAPACITY_UNIT_MINIMUM, Long.MAX_VALUE)); bindingContext.addValidationStatusProvider(readCapacityValidationStatusProvider); Label minimumReadCapacityLabel = new Label(throughputGroup, SWT.READ_ONLY); minimumReadCapacityLabel.setText("(Minimum capacity " + CAPACITY_UNIT_MINIMUM + ")"); minimumReadCapacityLabel.setFont(italicFont); new Label(throughputGroup, SWT.READ_ONLY).setText("Write Capacity Units:"); final Text writeCapacityText = CreateTablePageUtil.newTextField(throughputGroup); writeCapacityText.setText("" + CAPACITY_UNIT_MINIMUM); Label minimumWriteCapacityLabel = new Label(throughputGroup, SWT.READ_ONLY); minimumWriteCapacityLabel.setText("(Minimum capacity " + CAPACITY_UNIT_MINIMUM + ")"); minimumWriteCapacityLabel.setFont(italicFont); bindingContext.bindValue(SWTObservables.observeText(writeCapacityText, SWT.Modify), writeCapacityModel); ChainValidator<Long> writeCapacityValidationStatusProvider = new ChainValidator<Long>(writeCapacityModel, new RangeValidator("Please enter a write capacity of " + CAPACITY_UNIT_MINIMUM + " or more.", CAPACITY_UNIT_MINIMUM, Long.MAX_VALUE)); bindingContext.addValidationStatusProvider(writeCapacityValidationStatusProvider); final Label throughputCapacityLabel = new Label(throughputGroup, SWT.WRAP); throughputCapacityLabel .setText("This throughput is separate from and in addition to the primary table's throughput."); GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); gridData.horizontalSpan = 3; gridData.widthHint = 200; throughputCapacityLabel.setLayoutData(gridData); throughputCapacityLabel.setFont(italicFont); // 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.getSeverity() == Status.ERROR) { setErrorMessage(status.getMessage()); if (okButton != null) { okButton.setEnabled(false); } } else { setErrorMessage(null); if (okButton != null) { okButton.setEnabled(true); } } } }); bindingContext.updateModels(); return composite; }