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:gov.redhawk.prf.ui.wizard.EnumerationWizardPage.java
License:Open Source License
/** * {@inheritDoc}//from www. java 2s. co m */ @Override public void createControl(final Composite parent) { // Create an adapter factory that yields item providers. // this.adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); this.adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); this.adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); Label label; Text text; final Composite client = new Composite(parent, SWT.NULL); client.setLayout(new GridLayout(2, false)); label = new Label(client, SWT.NULL); label.setText("Label:"); text = new Text(client, SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); text.setToolTipText("The Enumeration Label"); // Bind and validate this.context.bindValue(SWTObservables.observeText(text, SWT.Modify), EMFObservables.observeValue(this.enumeration, PrfPackage.Literals.ENUMERATION__LABEL), null, null); label = new Label(client, SWT.NULL); label.setText("Value:"); text = new Text(client, SWT.BORDER); text.setToolTipText("The Enumeration Value"); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); this.context.bindValue(SWTObservables.observeText(text, SWT.Modify), EMFObservables.observeValue(this.enumeration, PrfPackage.Literals.ENUMERATION__VALUE), null, null); final EmfValidationStatusProvider provider = new EmfValidationStatusProvider(this.enumeration, this.context, this.adapterFactory); this.context.addValidationStatusProvider(provider); this.pageSupport = WizardPageSupport.create(this, this.context); this.setControl(client); }
From source file:gov.redhawk.sca.ui.preferences.DomainEntryWizardPage.java
License:Open Source License
/** * {@inheritDoc}// www . j a v a2 s. c o m */ @Override public void createControl(final Composite parent) { final Composite container = new Composite(parent, SWT.NONE); final GridLayout gridLayout = new GridLayout(2, false); container.setLayout(gridLayout); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); final Label domainNameLabel = new Label(container, SWT.NONE); domainNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); domainNameLabel.setText("Domain Name:"); final Text domainNameField = new Text(container, SWT.BORDER); domainNameField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); UpdateValueStrategy validator = new UpdateValueStrategy(); final Label nameServiceLabel = new Label(container, SWT.NONE); nameServiceLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); nameServiceLabel.setText("Name Service Initial Reference:"); final Text nameServiceField = new Text(container, SWT.BORDER); nameServiceField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); // Add the domainName validator, needs to reference the initref validator.setAfterConvertValidator(new IValidator() { @Override public IStatus validate(final Object value) { try { final String name = (String) value; if ((name == null) || (name.length() == 0)) { DomainEntryWizardPage.this.errors[0] = "Must enter a domain name."; return ValidationStatus.error(DomainEntryWizardPage.this.errors[0]); } final boolean contained = DomainEntryWizardPage.this.domainNames.contains(name); // if we're not editing, the domain name must be different if (DomainEntryWizardPage.this.editDomainName == null) { if (contained) { DomainEntryWizardPage.this.errors[0] = "Domain Name already exists, please enter another."; return ValidationStatus.error(DomainEntryWizardPage.this.errors[0]); } } else { // If we are editing, the domain name can be the same, but it must // match the edited domain name and the initRef must be different final boolean initRefSame = DomainEntryWizardPage.this.editInitRef .equals(DomainEntryWizardPage.this.model.getNameServiceInitRef()); if (contained && !(name.equals(DomainEntryWizardPage.this.editDomainName) && !initRefSame)) { DomainEntryWizardPage.this.errors[0] = "Domain Name already exists, please enter another."; return ValidationStatus.error(DomainEntryWizardPage.this.errors[0]); } } DomainEntryWizardPage.this.errors[0] = null; return ValidationStatus.ok(); } finally { DomainEntryWizardPage.this.updateMessage(); } } }); final Binding nameBinding = this.context.bindValue(SWTObservables.observeText(domainNameField, SWT.Modify), BeansObservables.observeValue(this.model, DomainSettingModel.PROP_DOMAIN_NAME), validator, null); // Add the InitRef validator validator = new UpdateValueStrategy(); validator.setAfterConvertValidator(new IValidator() { @Override public IStatus validate(final Object value) { final int WAIT_TIME = 100; try { final String newValue = (String) value; if (newValue == null || newValue.length() == 0) { DomainEntryWizardPage.this.errors[1] = "Must enter a Name Service Initial Reference."; return ValidationStatus.error(DomainEntryWizardPage.this.errors[1]); } DomainEntryWizardPage.this.errors[1] = null; if (DomainEntryWizardPage.this.editDomainName != null) { final UIJob j = new UIJob(getShell().getDisplay(), "Revalidate Domain Name") { @Override public IStatus runInUIThread(final IProgressMonitor monitor) { nameBinding.validateTargetToModel(); return Status.OK_STATUS; } }; j.schedule(WAIT_TIME); } return ValidationStatus.ok(); } finally { DomainEntryWizardPage.this.updateMessage(); } } }); this.context.bindValue(SWTObservables.observeText(nameServiceField, SWT.Modify), BeansObservables.observeValue(this.model, DomainSettingModel.PROP_NAME_SERVICE_INIT_REF), validator, null); if (this.showExtraSettings) { createConnectionSettingsGroup(container); } setControl(container); }
From source file:gov.redhawk.ui.views.domainbrowser.view.DomainEntryWizardPage.java
License:Open Source License
/** * {@inheritDoc}//from w w w . ja v a 2 s .c om */ @Override public void createControl(final Composite parent) { final Composite container = new Composite(parent, SWT.NONE); final GridLayout gridLayout = new GridLayout(2, false); container.setLayout(gridLayout); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); final Label domainNameLabel = new Label(container, SWT.NONE); domainNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); domainNameLabel.setText("Domain Name:"); this.domainNameField = new Text(container, SWT.BORDER); domainNameField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); UpdateValueStrategy validator = new UpdateValueStrategy(); // Add the domainName validator, needs to reference the initref validator.setAfterConvertValidator(new IValidator() { @Override public IStatus validate(final Object value) { try { final String name = (String) value; if ((name == null) || (name.length() == 0)) { DomainEntryWizardPage.this.errors[0] = "Must enter a domain name."; return ValidationStatus.error(DomainEntryWizardPage.this.errors[0]); } DomainEntryWizardPage.this.errors[0] = null; return ValidationStatus.ok(); } finally { DomainEntryWizardPage.this.updateMessage(); } } }); final Binding nameBinding = this.context.bindValue(SWTObservables.observeText(domainNameField, SWT.Modify), BeansObservables.observeValue(this.model, DomainSettingModel.PROP_DOMAIN_NAME), validator, null); final Label nameServiceLabel = new Label(container, SWT.NONE); nameServiceLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); nameServiceLabel.setText("Name Service Initial Reference:"); this.nameServiceField = new Text(container, SWT.BORDER); nameServiceField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); // Add the InitRef validator validator = new UpdateValueStrategy(); validator.setAfterConvertValidator(new IValidator() { @Override public IStatus validate(final Object value) { try { final String newValue = (String) value; if (newValue == null || newValue.length() == 0) { DomainEntryWizardPage.this.errors[1] = "Must enter a Name Service Initial Reference."; return ValidationStatus.error(DomainEntryWizardPage.this.errors[1]); } DomainEntryWizardPage.this.errors[1] = null; return ValidationStatus.ok(); } finally { DomainEntryWizardPage.this.updateMessage(); } } }); this.context.bindValue(SWTObservables.observeText(nameServiceField, SWT.Modify), BeansObservables.observeValue(this.model, DomainSettingModel.PROP_NAME_SERVICE_INIT_REF), validator, null); setControl(container); }
From source file:it.rcpvision.emf.components.binding.FormControlFactory.java
License:Open Source License
protected ControlObservablePair createControlAndObservableWithoutPredefinedProposals(List<?> proposals) { Text t = toolkit.createText(parent, ""); t.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); addContentProposalAdapter(t, proposals); ControlObservablePair retValAndTargetPair = new ControlObservablePair(); retValAndTargetPair.setControl(t);//from w ww . j a v a2s .c o m retValAndTargetPair.setObservableValue(SWTObservables.observeText(t, SWT.Modify)); return retValAndTargetPair; }
From source file:madcow.magic.ui.application.MagicApplicationGUI.java
License:Open Source License
/** * @param dbc//from w w w.j a va2s. c o m * @param cardSelection * @param collCardSelection */ private void initCardInfoTextBinding(EMFDataBindingContext dbc, IObservableValue cardSelection) { UpdateValueStrategy updateStrategy = new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_UPDATE); UpdateValueStrategy requestStrategy = new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_ON_REQUEST); IEMFValueProperty pName = EMFProperties.value(DatabasePackage.Literals.MAGIC_DB_ELEMENT__NAME); dbc.bindValue(SWTObservables.observeText(cardName, SWT.Modify), pName.observeDetail(cardSelection), requestStrategy, updateStrategy); IEMFValueProperty pMana = EMFProperties.value(CardPackage.Literals.CARD__MANACOST_STRING); dbc.bindValue(SWTObservables.observeText(manaCost, SWT.Modify), pMana.observeDetail(cardSelection), requestStrategy, updateStrategy); IEMFValueProperty pTypes = EMFProperties.value(CardPackage.Literals.CARD__TYPE_STRING); dbc.bindValue(SWTObservables.observeText(types, SWT.Modify), pTypes.observeDetail(cardSelection), requestStrategy, updateStrategy); IEMFValueProperty pSubTypes = EMFProperties.value(CardPackage.Literals.CARD__SUBTYPE); dbc.bindValue(SWTObservables.observeText(subTypes, SWT.Modify), pSubTypes.observeDetail(cardSelection), requestStrategy, updateStrategy); IEMFValueProperty pText = EMFProperties.value(DatabasePackage.Literals.MAGIC_DB_ELEMENT__DESCRIPTION); dbc.bindValue(SWTObservables.observeText(cardText, SWT.Modify), pText.observeDetail(cardSelection), requestStrategy, updateStrategy); IEMFValueProperty pExpansion = EMFProperties.value(FeaturePath.fromList(CardPackage.Literals.CARD__SET, DatabasePackage.Literals.MAGIC_DB_ELEMENT__NAME)); dbc.bindValue(SWTObservables.observeText(expansion, SWT.Modify), pExpansion.observeDetail(cardSelection), requestStrategy, updateStrategy); IEMFValueProperty pArtist = EMFProperties.value(CardPackage.Literals.CARD__ARTIST); dbc.bindValue(SWTObservables.observeText(artist, SWT.Modify), pArtist.observeDetail(cardSelection), requestStrategy, updateStrategy); IObservableList raritys = EMFObservables.observeList(CardPackage.Literals.RARITY_TYPE, EcorePackage.Literals.EENUM__ELITERALS); IEMFValueProperty pRarityName = EMFProperties.value(EcorePackage.Literals.EENUM_LITERAL__LITERAL); ViewerSupport.bind(rarityViewer, raritys, pRarityName); //IEMFValueProperty pFlavor = EMFProperties.value(CardPackage.Literals.CARD__MANACOST_STRING); //UpdateValueStrategy updateStrategyTemp = new UpdateValueStrategy(true, // UpdateValueStrategy.POLICY_UPDATE); //updateStrategyTemp.setAfterGetValidator(new DummyValidator()); //updateStrategyTemp.setAfterConvertValidator(new DummyValidator()); //updateStrategyTemp.setBeforeSetValidator(new DummyValidator()); //IEMFValueProperty pFlavor = EMFProperties.value( // FeaturePath.fromList(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, // EcorePackage.Literals.ENAMED_ELEMENT__NAME)); //dbc.bindValue(SWTObservables.observeText(flavorText, SWT.Modify), // pFlavor.observeDetail(cardSelection), requestStrategy, updateStrategyTemp); }
From source file:madcow.magic.ui.application.MagicApplicationGUI.java
License:Open Source License
/** * @param dbc// w w w . j a v a2 s . com * @param cardSelection * @param collCardSelection */ private void initCardInfoNumberBinding(EMFDataBindingContext dbc, IObservableValue cardSelection) { UpdateValueStrategy updateNumberStrategy = new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_UPDATE); updateNumberStrategy.setConverter(NumberToStringConverter.fromInteger(false)); UpdateValueStrategy requestNumberStrategy = new UpdateValueStrategy(true, UpdateValueStrategy.POLICY_ON_REQUEST); requestNumberStrategy.setConverter(StringToNumberConverter.toInteger(false)); IEMFValueProperty pConvertedMana = EMFProperties.value(CardPackage.Literals.CARD__CONVERTED_MANA_COST); dbc.bindValue(SWTObservables.observeText(convertedManaCost, SWT.Modify), pConvertedMana.observeDetail(cardSelection), requestNumberStrategy, updateNumberStrategy); IEMFValueProperty pPower = EMFProperties.value(CardPackage.Literals.CREATURE__POWER); dbc.bindValue(SWTObservables.observeText(power, SWT.Modify), pPower.observeDetail(cardSelection), requestNumberStrategy, updateNumberStrategy); IEMFValueProperty pToughness = EMFProperties.value(CardPackage.Literals.CREATURE__TOUGHNESS); dbc.bindValue(SWTObservables.observeText(toughness, SWT.Modify), pToughness.observeDetail(cardSelection), requestNumberStrategy, updateNumberStrategy); IEMFValueProperty pNumber = EMFProperties.value(CardPackage.Literals.CARD__NUMBER); dbc.bindValue(SWTObservables.observeText(number, SWT.Modify), pNumber.observeDetail(cardSelection), requestNumberStrategy, updateNumberStrategy); }
From source file:mbtarranger.widgets.streaminspector.StreamInspector.java
License:Open Source License
protected DataBindingContext initDataBindings() { DataBindingContext bindingContext = new DataBindingContext(); ///*w w w . ja v a 2 s . c om*/ IObservableValue slider_translateXSelectionObserveValue = BeansObservables.observeValue(slider_translateX, "selection"); IObservableValue interactionModelTranslate_xObserveValue = BeansObservables.observeValue(interactionModel, "translate_x"); bindingContext.bindValue(slider_translateXSelectionObserveValue, interactionModelTranslate_xObserveValue, null, null); // IObservableValue slider_translateYSelectionObserveValue = BeansObservables.observeValue(slider_translateY, "selection"); IObservableValue interactionModelTranslate_yObserveValue = BeansObservables.observeValue(interactionModel, "translate_y"); bindingContext.bindValue(slider_translateYSelectionObserveValue, interactionModelTranslate_yObserveValue, null, null); // IObservableValue slider_translateXMaximumObserveValue = BeansObservables.observeValue(slider_translateX, "maximum"); IObservableValue interactionModelTranslate_xMaxObserveValue = BeansObservables .observeValue(interactionModel, "translate_xMax"); bindingContext.bindValue(slider_translateXMaximumObserveValue, interactionModelTranslate_xMaxObserveValue, null, null); // IObservableValue canvas_plot1ObserveSizeObserveWidget = SWTObservables.observeSize(canvas_plot1); IObservableValue interactionModelPlotSizeObserveValue = BeansObservables.observeValue(interactionModel, "plotSize"); bindingContext.bindValue(canvas_plot1ObserveSizeObserveWidget, interactionModelPlotSizeObserveValue, null, null); // IObservableValue slider_translateYMaximumObserveValue = BeansObservables.observeValue(slider_translateY, "maximum"); IObservableValue interactionModelTranslate_yMaxObserveValue = BeansObservables .observeValue(interactionModel, "translate_yMax"); bindingContext.bindValue(slider_translateYMaximumObserveValue, interactionModelTranslate_yMaxObserveValue, null, null); // IObservableValue text_AltsPerBinObserveTextObserveWidget = SWTObservables.observeText(text_AltsPerBin, SWT.Modify); IObservableValue interactionModelNumAltsPerBinObserveValue = BeansObservables.observeValue(interactionModel, "numAltsPerBin"); bindingContext.bindValue(text_AltsPerBinObserveTextObserveWidget, interactionModelNumAltsPerBinObserveValue, null, null); // return bindingContext; }
From source file:net.bioclipse.qsar.ui.editors.InformationPage.java
License:Open Source License
private void createGeneralTab(FormToolkit toolkit) { CTabItem item = new CTabItem(tabFolder, SWT.NULL); item.setText("General information"); QsarType qsarModel = ((QsarEditor) getEditor()).getQsarModel(); Composite tabContent = toolkit.createComposite(tabFolder); item.setControl(tabContent);//from w w w. j a va 2 s . c o m tabContent.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(); tabContent.setLayout(layout); layout.numColumns = 2; layout.marginWidth = 0; //Dataset Name //============= Label lblDatasetName = toolkit.createLabel(tabContent, "Dataset Name:", SWT.NONE); GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); lblDatasetName.setLayoutData(gd2); Text txtDatasetName = toolkit.createText(tabContent, "", SWT.MULTI | SWT.WRAP); GridData gd = new GridData(GridData.FILL_HORIZONTAL); txtDatasetName.setLayoutData(gd); gd.heightHint = 16; // Bind to EMF DataBindingContext bindingContext = new DataBindingContext(); bindingContext.bindValue(SWTObservables.observeText(txtDatasetName, SWT.Modify), EMFEditObservables.observeValue(editingDomain, qsarModel.getMetadata(), QsarPackage.Literals.METADATA_TYPE__DATASETNAME), null, null); //Authors //============= Label lblAuthors = toolkit.createLabel(tabContent, "Author(s)", SWT.NONE); GridData gd3 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); lblAuthors.setLayoutData(gd3); Text txtAuthors = toolkit.createText(tabContent, "", SWT.MULTI | SWT.WRAP); GridData gd4 = new GridData(GridData.FILL_HORIZONTAL); txtAuthors.setLayoutData(gd4); gd4.heightHint = 40; // Bind to EMF bindingContext.bindValue(SWTObservables.observeText(txtAuthors, SWT.Modify), EMFEditObservables .observeValue(editingDomain, qsarModel.getMetadata(), QsarPackage.Literals.METADATA_TYPE__AUTHORS), null, null); //Description //============= Label lblDescription = toolkit.createLabel(tabContent, "Description:", SWT.NONE); GridData gd9 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); lblDescription.setLayoutData(gd9); Text txtDescription = toolkit.createText(tabContent, "", SWT.MULTI | SWT.WRAP); GridData gd10 = new GridData(GridData.FILL_HORIZONTAL); txtDescription.setLayoutData(gd10); gd10.heightHint = 70; // Bind to EMF bindingContext.bindValue(SWTObservables.observeText(txtDescription, SWT.Modify), EMFEditObservables.observeValue(editingDomain, qsarModel.getMetadata(), QsarPackage.Literals.METADATA_TYPE__DESCRIPTION), null, null); //URL //============= Label lblUrl = toolkit.createLabel(tabContent, "URL:", SWT.NONE); GridData gd5 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); lblUrl.setLayoutData(gd5); Text txtUrl = toolkit.createText(tabContent, "", SWT.MULTI | SWT.WRAP); GridData gd6 = new GridData(GridData.FILL_HORIZONTAL); txtUrl.setLayoutData(gd6); gd6.heightHint = 16; // Bind to EMF bindingContext.bindValue(SWTObservables.observeText(txtUrl, SWT.Modify), EMFEditObservables.observeValue( editingDomain, qsarModel.getMetadata(), QsarPackage.Literals.METADATA_TYPE__URL), null, null); //License //============= Label lblLicense = toolkit.createLabel(tabContent, "License:", SWT.NONE); GridData gd7 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); lblLicense.setLayoutData(gd7); Text txtLicense = toolkit.createText(tabContent, "", SWT.MULTI | SWT.WRAP); GridData gd8 = new GridData(GridData.FILL_BOTH); txtLicense.setLayoutData(gd8); // Bind to EMF bindingContext.bindValue(SWTObservables.observeText(txtLicense, SWT.Modify), EMFEditObservables .observeValue(editingDomain, qsarModel.getMetadata(), QsarPackage.Literals.METADATA_TYPE__LICENSE), null, null); }
From source file:net.sf.jasperreports.eclipse.wizard.project.JRProjectPage.java
License:Open Source License
public void createControl(Composite parent) { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); Composite composite = new Composite(parent, SWT.NONE); setControl(composite);/*from w ww .ja v a 2s . c om*/ composite.setLayout(new GridLayout(2, false)); new Label(composite, SWT.NONE).setText(Messages.JRProjectPage_LblName); Text tname = new Text(composite, SWT.BORDER); tname.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(gd); dbc.bindValue(SWTObservables.observeText(tname, SWT.Modify), PojoObservables.observeValue(this, "name"), //$NON-NLS-1$ new UpdateValueStrategy().setAfterConvertValidator(new EmptyStringValidator() { @Override public IStatus validate(Object value) { IStatus s = super.validate(value); if (s.equals(Status.OK_STATUS)) { IProject[] prjs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (IProject p : prjs) { if (p.getName().equals(value)) return ValidationStatus.error(Messages.JRProjectPage_ErrorExistingProject); } } return s; } }), null); }
From source file:net.sf.rcer.conn.ui.login.LoginDialog.java
License:Open Source License
/** * Connects the UI elements to the model elements. *//*from w ww.ja v a 2 s. c o m*/ private void bindUserInterface() { // set the values of the locales combo final Collection<Locale> locales = LocaleRegistry.getInstance().getLocales(); final Iterator<Locale> it = locales.iterator(); final LocaleToStringConverter converter = new LocaleToStringConverter(true); String[] entries = new String[locales.size() + 1]; for (int i = 0; i < locales.size(); i++) { entries[i] = (String) converter.convert(it.next()); } entries[locales.size()] = ""; //$NON-NLS-1$ localeCombo.setItems(entries); context = new DataBindingContext(); // observe changes in the selection of the connection combo IObservableValue selection = ViewersObservables.observeSingleSelection(connectionComboViewer); IObservableValue connection = BeansObservables.observeDetailValue(selection, "connection", //$NON-NLS-1$ IConnection.class); // bind the client context.bindValue(SWTObservables.observeText(clientText, SWT.Modify), BeansObservables.observeDetailValue(connection, "client", String.class), //$NON-NLS-1$ new UpdateValueStrategy(), new UpdateValueStrategy()); context.bindValue(SWTObservables.observeEnabled(clientText), BeansObservables.observeDetailValue(connection, "clientEditable", boolean.class), //$NON-NLS-1$ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy()); // bind the user name context.bindValue(SWTObservables.observeText(userText, SWT.Modify), BeansObservables.observeDetailValue(connection, "userName", String.class), //$NON-NLS-1$ new UpdateValueStrategy(), new UpdateValueStrategy()); context.bindValue(SWTObservables.observeEnabled(userText), BeansObservables.observeDetailValue(connection, "userEditable", boolean.class), //$NON-NLS-1$ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy()); // bind the password context.bindValue(SWTObservables.observeText(passwordText, SWT.Modify), BeansObservables.observeDetailValue(selection, "password", String.class), //$NON-NLS-1$ new UpdateValueStrategy(), new UpdateValueStrategy()); // bind the locale context.bindValue(SWTObservables.observeSelection(localeCombo), BeansObservables.observeDetailValue(connection, "locale", Locale.class), //$NON-NLS-1$ new UpdateValueStrategy().setConverter(new LocaleFromStringConverter()), new UpdateValueStrategy().setConverter(new LocaleToStringConverter(true))); context.bindValue(SWTObservables.observeEnabled(localeCombo), BeansObservables.observeDetailValue(connection, "localeEditable", boolean.class), //$NON-NLS-1$ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy()); // provide the connection list with input data connectionComboViewer.setContentProvider(new ObservableListContentProvider()); connectionComboViewer.setInput(credentials); // select the first entry connectionComboViewer.setSelection(new StructuredSelection(credentials.get(0))); // only enable the combo box if more than one connection can be chosen connectionComboViewer.getCombo().setEnabled(credentials.size() > 1); }