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:es.cv.gvcase.fefem.common.composites.EMFPropertyEReferenceComposite.java
License:Open Source License
@Override protected IObservableValue getTargetObservable() { return SWTObservables.observeText(chooser.getText(), SWT.Modify); }
From source file:es.cv.gvcase.fefem.common.composites.EMFPropertyHierarchyEReferenceComposite.java
License:Open Source License
@Override protected IObservableValue getTargetObservable() { return SWTObservables.observeText(selectionText, SWT.Modify); }
From source file:es.cv.gvcase.fefem.common.composites.EMFPropertyStringComposite.java
License:Open Source License
@Override protected IObservableValue getTargetObservable() { return SWTObservables.observeText(text, SWT.Modify); }
From source file:gov.nasa.ensemble.core.detail.emf.binding.IPathBindingFactory.java
License:Open Source License
/** * This is its own method so that a 3.5-based subclass can override it to use the version of observeText which takes an array of event types. *//* w w w.ja v a 2s. com*/ protected IObservableValue observeText(Control control) { return SWTObservables.observeText(control, new int[] { SWT.FocusOut, SWT.DefaultSelection }); }
From source file:gov.nasa.ensemble.core.detail.emf.binding.URIBindingFactory.java
License:Open Source License
@Override public Binding createBinding(DetailProviderParameter p) { FormToolkit toolkit = p.getDetailFormToolkit(); Composite parent = p.getParent(); EObject target = p.getTarget();/* w w w . j a va2 s .c o m*/ IItemPropertyDescriptor pd = p.getPropertyDescriptor(); Object propertyValueObject = pd.getPropertyValue(target); String propertyName = pd.getDisplayName(target); String propertyValue = null; if (propertyValueObject != null && propertyValueObject instanceof PropertyValueWrapper) { PropertyValueWrapper propertyValueWrapper = (PropertyValueWrapper) propertyValueObject; Object editableValue = propertyValueWrapper.getEditableValue(target); propertyValue = editableValue.toString(); } if (propertyValue == null) { propertyValue = ""; } uriConverter = target.eResource().getResourceSet().getURIConverter(); projectUriStringfier = new URIStrigifier(uriConverter); EMFDetailUtils.createLabel(parent, toolkit, target, pd); Composite rootComposite = createRootComposite(toolkit, parent); Composite hyperlinkAndBrowseComposite = hyperlinkAndBrowseComposite(rootComposite); Text hyperlinkTextField = createHyperlinkTextField(hyperlinkAndBrowseComposite, propertyValue); Button browseButton = createBrowseButton(hyperlinkAndBrowseComposite, hyperlinkTextField); Button openButton = createOpenButton(rootComposite, propertyName, hyperlinkTextField); hyperlinkAndBrowseComposite.setData(BUTTON_KEY, openButton); openButton.setEnabled(!hyperlinkTextField.getText().trim().equals("")); StringifierUpdateValueStrategy targetToModel = new ProjectUrlUpdateValueStrategy( UpdateValueStrategy.POLICY_UPDATE); StringifierUpdateValueStrategy modelToTarget = new ProjectUrlUpdateValueStrategy( UpdateValueStrategy.POLICY_UPDATE); ISWTObservableValue observeText = SWTObservables.observeText(hyperlinkTextField, SWT.FocusOut); EMFDetailUtils.bindValidatorDecoration(p, hyperlinkTextField); EMFDetailUtils.bindControlViability(p, new Control[] { browseButton, openButton, hyperlinkTextField }); Binding binding = EMFDetailUtils.bindEMFUndoable(p, observeText, targetToModel, modelToTarget); EMFDetailUtils.bindTextModifyUndoable(hyperlinkTextField, target, propertyName); targetToModel.setBinding(binding); return binding; }
From source file:gov.nasa.ensemble.core.detail.emf.binding.URLBindingFactory.java
License:Open Source License
@Override public Binding createBinding(DetailProviderParameter p) { FormToolkit toolkit = p.getDetailFormToolkit(); Composite parent = p.getParent(); EObject target = p.getTarget();/*from w w w. j a v a 2 s. co m*/ IItemPropertyDescriptor pd = p.getPropertyDescriptor(); Object propertyValueObject = pd.getPropertyValue(target); String propertyName = pd.getDisplayName(target); String propertyValue = null; if (propertyValueObject != null && propertyValueObject instanceof PropertyValueWrapper) { PropertyValueWrapper propertyValueWrapper = (PropertyValueWrapper) propertyValueObject; Object editableValue = propertyValueWrapper.getEditableValue(target); propertyValue = editableValue.toString(); } if (propertyValue == null) { propertyValue = ""; } EMFDetailUtils.createLabel(parent, toolkit, target, pd); Composite rootComposite = createRootComposite(toolkit, parent); Composite hyperlinkAndBrowseComposite = hyperlinkAndBrowseComposite(rootComposite); Text hyperlinkTextField = createHyperlinkTextField(hyperlinkAndBrowseComposite, propertyValue); @SuppressWarnings("unused") Button browseButton = createBrowseButton(hyperlinkAndBrowseComposite, hyperlinkTextField); Button openButton = createOpenButton(rootComposite, propertyName, hyperlinkTextField); hyperlinkAndBrowseComposite.setData(BUTTON_KEY, openButton); openButton.setEnabled(!hyperlinkTextField.getText().trim().equals("")); StringifierUpdateValueStrategy targetToModel = new StringifierUpdateValueStrategy( UpdateValueStrategy.POLICY_UPDATE); StringifierUpdateValueStrategy modelToTarget = new StringifierUpdateValueStrategy( UpdateValueStrategy.POLICY_UPDATE); ISWTObservableValue observeText = SWTObservables.observeText(hyperlinkTextField, SWT.FocusOut); EMFDetailUtils.bindValidatorDecoration(p, hyperlinkTextField); EMFDetailUtils.bindControlViability(p, new Control[] { browseButton, openButton, hyperlinkTextField }); Binding binding = EMFDetailUtils.bindEMFUndoable(p, observeText, targetToModel, modelToTarget); EMFDetailUtils.bindTextModifyUndoable(hyperlinkTextField, target, propertyName); targetToModel.setBinding(binding); return binding; }
From source file:gov.redhawk.ide.codegen.jet.java.ui.JavaJetGeneratorPropertiesWizardPage.java
License:Open Source License
private void bind() { for (final Binding b : this.bindings) { this.context.removeBinding(b); }/* ww w .j a v a2s .com*/ this.support = WizardPageSupport.create(this, this.context); initFields(); this.bindings.add(this.context.bindValue(ViewersObservables.observeSingleSelection(this.templateViewer), EMFObservables.observeValue(this.implSettings, CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__TEMPLATE), createTemplateTargetToModel(), createTemplateModelToTarget())); this.bindings.add(this.context.bindValue(SWTObservables.observeText(this.outputDirText, SWT.Modify), EMFObservables.observeValue(this.implSettings, CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__OUTPUT_DIR), new UpdateValueStrategy().setAfterConvertValidator(new OutputDirectoryValidator(this.softPkg)), null)); this.bindings.add(this.context.bindValue(SWTObservables.observeText(this.packageNameText, SWT.Modify), EMFObservables.observeValue(JavaJetGeneratorPropertiesWizardPage.this.packageName, CodegenPackage.Literals.PROPERTY__VALUE), new UpdateValueStrategy().setAfterConvertValidator(new JavaPackageNameValidator()), null)); if ((this.implSettings.getOutputDir() == null) || "".equals(this.implSettings.getOutputDir().trim())) { setDefaults(); } else { selectInitialTemplate(false); } final List<IPropertyDescriptor> propList = new ArrayList<IPropertyDescriptor>(); for (final IPropertyDescriptor prop : this.selectedTemplate.getPropertyDescriptors()) { if (!"java_package".equals(prop.getKey())) { propList.add(prop); } } this.propertiesViewer.setInput(propList); this.propBinding = createPropertyBinding(); this.bindings.add(this.propBinding); }
From source file:gov.redhawk.ide.codegen.ui.BooleanGeneratorPropertiesWizardPage.java
License:Open Source License
private void bind() { for (final Binding b : this.bindings) { this.context.removeBinding(b); }//from w ww . ja v a2 s . c om initFields(); this.bindings.add(this.context.bindValue(ViewersObservables.observeSingleSelection(this.templateViewer), EMFObservables.observeValue(this.implSettings, CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__TEMPLATE), createTemplateTargetToModel(), createTemplateModelToTarget())); this.bindings.add(this.context.bindValue(SWTObservables.observeText(this.outputDirText, SWT.Modify), EMFObservables.observeValue(this.implSettings, CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__OUTPUT_DIR), new UpdateValueStrategy().setAfterConvertValidator(new OutputDirectoryValidator(this.softPkg)), null)); if (this.implSettings.getOutputDir() == null || this.implSettings.getOutputDir().trim().isEmpty()) { setDefaults(); } else { selectInitialTemplate(false); } this.propertiesViewer.setInput(this.selectedTemplate.getPropertyDescriptors()); this.propBinding = createPropertyBinding(); this.bindings.add(this.propBinding); this.support = WizardPageSupport.create(this, this.context); }
From source file:gov.redhawk.ide.codegen.ui.DefaultGeneratorPropertiesWizardPage.java
License:Open Source License
private void bind() { initFields();//ww w . j av a2s . com this.context.bindValue(ViewersObservables.observeSingleSelection(this.templateViewer), EMFObservables.observeValue(this.implSettings, CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__TEMPLATE), createTemplateTargetToModel(), createTemplateModelToTarget()); this.context.bindValue(SWTObservables.observeText(this.outputDirText, SWT.Modify), EMFObservables.observeValue(this.implSettings, CodegenPackage.Literals.IMPLEMENTATION_SETTINGS__OUTPUT_DIR), new UpdateValueStrategy().setAfterConvertValidator(new OutputDirectoryValidator(this.softPkg)), null); if ((this.implSettings.getOutputDir() == null) || "".equals(this.implSettings.getOutputDir().trim())) { setDefaults(); } else { selectInitialTemplate(false); } this.propertiesViewer.setInput(this.implSettings); this.context.addValidationStatusProvider(new AllRequiredPropertiesValidator()); this.support = WizardPageSupport.create(this, this.context); }
From source file:gov.redhawk.ide.dcd.internal.ui.handlers.LaunchDeviceManagerDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { Label label = new Label(parent, SWT.NULL); label.setText("Debug Level: "); ComboViewer debugViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER); debugViewer.setContentProvider(new ArrayContentProvider()); debugViewer.setInput(DebugLevel.values()); debugViewer.setSelection(new StructuredSelection(DebugLevel.Info)); context.bindValue(ViewersObservables.observeSingleSelection(debugViewer), PojoObservables.observeValue(configuration, DeviceManagerLaunchConfiguration.PROP_DEBUG_LEVEL)); label = new Label(parent, SWT.NULL); label.setText("Arguments: "); Text text = new Text(parent, SWT.BORDER); context.bindValue(SWTObservables.observeText(text, SWT.Modify), PojoObservables.observeValue(configuration, DeviceManagerLaunchConfiguration.PROP_ARGUMENTS)); super.createButtonsForButtonBar(parent); }