Posts Tagged ‘databinding’

Eclipse databinding without Eclipse

One can use Eclipse databinding also outside of Eclipse (for standalone SWT applications). In that case a Realm must be generated manually: public static void main(String[] args) { Realm.runWithDefault(SWTObservables.getRealm(Display.getDefault()), new Runnable() { @Override public void run() { // Run your code with Eclipse databindings. } }); }

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 );