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.lambda.upload.wizard.page.TargetFunctionSelectionPage.java
License:Open Source License
private void bindControls() { useExistingJavaFunctionRadioButtonObservable = SWTObservables .observeSelection(useExistingJavaFunctionRadioButton); createNewJavaFunctionRadioButtonObservable = SWTObservables .observeSelection(createNewJavaFunctionRadioButton); bindingContext.bindValue(createNewJavaFunctionRadioButtonObservable, PojoObservables.observeValue(dataModel, UploadFunctionWizardDataModel.P_IS_CREATING_NEW_FUNCTION)); newJavaFunctionNameTextObservable = SWTObservables.observeText(newJavaFunctionNameText, SWT.Modify); bindingContext.bindValue(newJavaFunctionNameTextObservable, PojoObservables.observeValue(dataModel, UploadFunctionWizardDataModel.P_NEW_FUNCTION_NAME)); }
From source file:com.amazonaws.eclipse.rds.SelectExistingDatabasePage.java
License:Apache License
@SuppressWarnings("static-access") private void bindControls() { bindingContext.bindValue(new ControlDataObservableValue(SWTObservables.observeSelection(dbCombo), true), PojoObservables.observeValue(wizardDataModel, wizardDataModel.DB_INSTANCE), null, null); }
From source file:com.ebmwebsourcing.petals.common.internal.provisional.emf.EObjectUIHelper.java
License:Open Source License
/** * Sets up the data binding./*from ww w . ja v a 2s .c o m*/ * @param eObject * @param domain * @param dbc * @param entries */ private static void setUpDatabinding(EObject eObject, EditingDomain domain, DataBindingContext dbc, boolean showDecorator, List<EntryDescription> entries) { for (EntryDescription entry : entries) { IObservableValue widgetObservable = null; if (entry.widget instanceof Text) widgetObservable = SWTObservables.observeDelayedValue(300, SWTObservables.observeText((Text) entry.widget, SWT.Modify)); else if (entry.widget instanceof StyledText) widgetObservable = SWTObservables.observeDelayedValue(300, SWTObservables.observeText((StyledText) entry.widget, SWT.Modify)); else if (entry.widget instanceof Spinner) widgetObservable = SWTObservables.observeSelection((Spinner) entry.widget); else if (entry.widget instanceof ISelectionProvider) widgetObservable = ViewersObservables.observeSingleSelection((ISelectionProvider) entry.widget); else if (entry.widget instanceof Button) widgetObservable = SWTObservables.observeSelection((Button) entry.widget); if (widgetObservable != null) { UpdateValueStrategy targetToModel = new UpdateValueStrategy(); if (entry.attribute.getLowerBound() > 0) targetToModel.setBeforeSetValidator(new MandatoryFieldValidator(entry.attribute)); IObservableValue iov = domain == null ? EMFObservables.observeValue(eObject, entry.attribute) // : EMFEditObservables.observeValue( domain, eObject, entry.attribute ); : createCustomEmfEditObservable(domain, eObject, entry.attribute); Binding binding; if (domain == null) binding = dbc.bindValue(widgetObservable, iov, targetToModel, null); else binding = dbc.bindValue(widgetObservable, iov); if (showDecorator && entry.attribute.getLowerBound() > 0) ControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT); } } }
From source file:com.googlecode.osde.internal.ui.OsdePreferenceBinder.java
License:Apache License
/** * Binds a <code>preferenceName<code> to the attribute of the provided <code>control</code>. * The supported controls are:/*from ww w . j av a 2 s . com*/ * <ul> * <li>org.eclipse.swt.widgets.Button (Radio or Checkbox)</li> * <li>org.eclipse.swt.widgets.Combo</li> * <li>org.eclipse.swt.widgets.Text</li> * </ul> * * The supported preference types are: * <ul> * <li>java.lang.Boolean</li> * <li>java.lang.String</li> * </ul> * * @param control * the SWT widget will be bound * @param preferenceName * a key used to the preference store * @param type * model type * @param targetToModel * strategy to employ when the target is the source of the change * and the model is the destination * @param modelToTarget * strategy to employ when the model is the source of the change * and the target is the destination */ public void bind(Control control, String preferenceName, Class<?> type, IConverter targetToModel, IConverter modelToTarget) { if (!ArrayUtils.contains(supportedTypes, type)) { throw new IllegalArgumentException("type[" + type + "] is not supported."); } IObservableValue model = new ObservableMapValue(store, preferenceName); IObservableValue ui = null; UpdateValueStrategy modelUpdater = new UpdateValueStrategy(); UpdateValueStrategy uiUpdater = new UpdateValueStrategy(); if (targetToModel != null) { modelUpdater.setConverter(targetToModel); } if (modelToTarget != null) { uiUpdater.setConverter(modelToTarget); } if (control instanceof Button) { boolean isRadio = (control.getStyle() & SWT.RADIO) != 0; boolean isCheck = (control.getStyle() & SWT.CHECK) != 0; if (isRadio || isCheck) { ui = SWTObservables.observeSelection(control); } } else if (control instanceof Text) { ui = SWTObservables.observeText(control, SWT.Modify); } else if (control instanceof Combo) { ui = SWTObservables.observeText(control); } if (ui == null) { logger.error(control + " is not supported yet."); throw new UnsupportedOperationException(control + " is not supported yet."); } propagateData(preferenceName, type); context.bindValue(ui, model, modelUpdater, uiUpdater); }
From source file:com.jaspersoft.studio.server.properties.DataTypeSection.java
License:Open Source License
protected void bind() { bindingContext.bindValue(SWTObservables.observeText(tpattern, SWT.Modify), PojoObservables.observeValue(res.getValue(), "pattern")); bindingContext.bindValue(SWTObservables.observeText(tmin, SWT.Modify), PojoObservables.observeValue(res.getValue(), "minValue")); bindingContext.bindValue(SWTObservables.observeText(tmax, SWT.Modify), PojoObservables.observeValue(res.getValue(), "maxValue")); bindingContext.bindValue(SWTObservables.observeSelection(bmin), PojoObservables.observeValue(res.getValue(), "strictMin")); bindingContext.bindValue(SWTObservables.observeSelection(bmax), PojoObservables.observeValue(res.getValue(), "strictMax")); bindingContext.bindValue(SWTObservables.observeSingleSelectionIndex(ttype), PojoObservables.observeValue(getProxy(res.getValue()), "dataType")); }
From source file:com.jaspersoft.studio.server.properties.InputControlSection.java
License:Open Source License
@Override protected void bind() { bindingContext.bindValue(SWTObservables.observeSingleSelectionIndex(ctype), PojoObservables.observeValue(getProxy(res.getValue()), "controlType")); bindingContext.bindValue(SWTObservables.observeSelection(bmand), PojoObservables.observeValue(res.getValue(), "mandatory")); bindingContext.bindValue(SWTObservables.observeSelection(bread), PojoObservables.observeValue(res.getValue(), "readOnly")); bindingContext.bindValue(SWTObservables.observeSelection(bvisible), PojoObservables.observeValue(res.getValue(), "visible")); }
From source file:com.jaspersoft.studio.server.properties.ReportUnitSection.java
License:Open Source License
@Override protected void bind() { ReportProxy v = getProxy(res.getValue()); bindingContext.bindValue(SWTObservables.observeSingleSelectionIndex(cictype), PojoObservables.observeValue(v, "layoutControl")); bindingContext.bindValue(SWTObservables.observeText(jspview, SWT.Modify), PojoObservables.observeValue(v, "jspView")); bindingContext.bindValue(SWTObservables.observeText(jspic, SWT.Modify), PojoObservables.observeValue(v, "jspIC")); bindingContext.bindValue(SWTObservables.observeSelection(ispromp), PojoObservables.observeValue(v, "allowPrompt")); }
From source file:com.muratools.eclipse.wizard.newTheme.NewThemePage.java
License:Apache License
protected DataBindingContext initDataBindings() { DataBindingContext bindingContext = new DataBindingContext(); //// w ww . ja v a 2s. co m IObservableValue themeSelectObserveEnabledObserveWidget = SWTObservables.observeEnabled(themeSelect); IObservableValue btnUseExistingThemeObserveSelectionObserveWidget = SWTObservables .observeSelection(btnUseExistingTheme); bindingContext.bindValue(themeSelectObserveEnabledObserveWidget, btnUseExistingThemeObserveSelectionObserveWidget, null, null); // return bindingContext; }
From source file:com.netxforge.netxstudio.callflow.screens.nodetypes.NewEditNodeType.java
License:Open Source License
public EMFDataBindingContext initDataBindings_() { EMFDataBindingContext context = new EMFDataBindingContext(); // Binding of name and Description IObservableValue nameObservable = SWTObservables.observeDelayedValue(400, SWTObservables.observeText(txtName, SWT.Modify)); IObservableValue leafObservable = SWTObservables.observeSelection(btnLeafNode); IEMFValueProperty nameProperty = EMFEditProperties.value(editingService.getEditingDomain(), LibraryPackage.Literals.NODE_TYPE__NAME); IEMFValueProperty leafProperty = EMFEditProperties.value(editingService.getEditingDomain(), LibraryPackage.Literals.NODE_TYPE__LEAF_NODE); context.bindValue(nameObservable, nameProperty.observe(nodeType), null, null); context.bindValue(leafObservable, leafProperty.observe(nodeType), null, null); // final NodeTypeSummary totals = (NodeTypeSummary) stateModel // .summary(nodeType); // this.frmTextNumberOfFunctions.setText( // totals.getFunctionCountAsString(), false, false); // this.frmTextNumberOfEquipments.setText( // totals.getEquipmentCountAsString(), false, false); // this.frmTextNumberOfResources.setText(totals.getResourCountAsString(), // false, false); return context; }
From source file:com.netxforge.netxstudio.screens.f2.details.NewEditNodeType.java
License:Open Source License
public EMFDataBindingContext initDataBindings_() { EMFDataBindingContext context = new EMFDataBindingContext(); // Binding of name and Description IObservableValue nameObservable = SWTObservables.observeDelayedValue(400, SWTObservables.observeText(txtName, SWT.Modify)); IObservableValue leafObservable = SWTObservables.observeSelection(btnLeafNode); IEMFValueProperty nameProperty = EMFEditProperties.value(editingService.getEditingDomain(), LibraryPackage.Literals.NODE_TYPE__NAME); IEMFValueProperty leafProperty = EMFEditProperties.value(editingService.getEditingDomain(), LibraryPackage.Literals.NODE_TYPE__LEAF_NODE); context.bindValue(nameObservable, nameProperty.observe(nodeType), null, null); context.bindValue(leafObservable, leafProperty.observe(nodeType), null, null); final NodeTypeSummary totals = (NodeTypeSummary) stateModel.summary(nodeType); this.frmTextNumberOfFunctions.setText(totals.getFunctionCountAsString(), false, false); this.frmTextNumberOfEquipments.setText(totals.getEquipmentCountAsString(), false, false); this.frmTextNumberOfResources.setText(totals.getResourCountAsString(), false, false); return context; }