@Test public void testIntegrationValue() throws DatabindingFailedException { final VFeaturePathDomainModelReference pathReference = VViewFactory.eINSTANCE.createFeaturePathDomainModelReference(); // create reference path to the attribute final LinkedList<EReference> referencePath = new LinkedList<EReference>(); referencePath.add(TestPackage.eINSTANCE.getA_B()); referencePath.add(TestPackage.eINSTANCE.getB_C()); referencePath.add(TestPackage.eINSTANCE.getC_D()); final EStructuralFeature feature = TestPackage.eINSTANCE.getD_X(); pathReference.getDomainModelEReferencePath().addAll(referencePath); pathReference.setDomainModelEFeature(feature); final IValueProperty valueProperty = databindingService.getValueProperty(pathReference, null); // The converter should return an IEMFValueProperty assertTrue(valueProperty instanceof IEMFValueProperty); final IEMFValueProperty emfProperty = (IEMFValueProperty) valueProperty; // Check EStructuralFeature of the property. assertEquals(feature, emfProperty.getStructuralFeature()); // Check correct path. final String expected = "A.b<B> => B.c<C> => C.d<D> => D.x<EString>"; // $NON-NLS-1$ assertEquals(expected, emfProperty.toString()); }
public void bind(EMFDataBindingContext context) { IObservableValue capExpressionObservable = SWTObservables.observeText(this.getTxtExpressionName(), SWT.Modify); IEMFValueProperty profileExpressionProperty = EMFEditProperties.value( editingService.getEditingDomain(), FeaturePath.fromList(expressionFeature, LibraryPackage.Literals.EXPRESSION__NAME)); context.bindValue( capExpressionObservable, profileExpressionProperty.observe(owner), null, null); }
@Override public void initialize(URL location, ResourceBundle resources) { bindingContextsView.setCellFactory( new Callback<ListView<MBindingContext>, ListCell<MBindingContext>>() { @Override public ListCell<MBindingContext> call(ListView<MBindingContext> param) { return new BindingCell(); } }); EMFDataBindingContext dbc = new EMFDataBindingContext(); { IJFXBeanValueProperty uiProp = JFXBeanProperties.value("text"); IEMFValueProperty mProp = EMFProperties.value(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); dbc.bindValue(uiProp.observe(idField), mProp.observeDetail(master)); } { IJFXBeanValueProperty uiProp = JFXBeanProperties.value("selected"); IEMFValueProperty mProp = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED); dbc.bindValue(uiProp.observe(renderField), mProp.observeDetail(master)); } { IJFXBeanValueProperty uiProp = JFXBeanProperties.value("selected"); IEMFValueProperty mProp = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE); dbc.bindValue(uiProp.observe(visibleField), mProp.observeDetail(master)); } { IEMFListProperty mProp = EMFProperties.list(CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS); IObservableList mList = mProp.observeDetail(master); ObservableList<MBindingContext> l = AdapterFactory.adapt(mList); bindingContextsView.setItems(l); } }