Posts Tagged ‘emf’

Databinding of an EMF EObject EMap value

Example to bind an EMF EObject EMap value (as it is a bit tricky) to a text field: bindingContext.bindValue( SWTObservables.observeText(textField), EMFObservables.observeValue((EObject) document.getProperties().get(document.getProperties().indexOfKey("title")), DocumentModelPackage.Literals.DOCUMENT_PROPERTY_MAP__VALUE), null, null );

EMF notifications of children of an EObject

The normal Adapter just get change events of the EObject it is bound to itself. To also get change events of children of the EObject simply use EContentAdapter instead. Cave: The overwritten notifyChanged method of EContentAdapter must at first call super.notifyChanged.

Add documentation comments EMF Ecore models

To add documentation that will be available in the generated EMF models use eAnnotations in your Ecore files: <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel";> <details key="documentation" value="This is the generated comment text."/> </eAnnotations>