Using EMF Data Binding with EMF models from separate projects [message #1070602] |
Thu, 18 July 2013 09:55 |
Emre T Messages: 119 Registered: April 2013 |
Senior Member |
|
|
Hello there,
I was wondering whether it is possible to use EMF Data Binding of the WindowBuilder only through referencing, e.g. through dependencies on MANIFEST of the project in which the SWT/JFace classes reside in.
I have managed to use dynamically created instances of an EMF model. For that I have registered the model into EMF registry and than called the URIs of the instances and loaded their contents into corresponding fields declared in my ViewPart class.
EPackage.Registry.INSTANCE.put(xModelPackage.eNS_URI, xModel.eINSTANCE);
xModel.eINSTANCE.eClass();
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
ResourceSet resSet = new ResourceSetImpl();
Resource resource = resSet.getResource(URI.createPlatformPluginURI("xModel/model/SimpleA.xmi", true), true);
Resource resource2 = resSet.getResource(URI.createPlatformPluginURI("xModel/model/A.xmi", true), true);
try {
resource.load(null);
a = (A) resource.getContents().get(0);
resource2.load(null);
a2 = (A) resource2.getContents().get(0);
} catch (IOException e){
e.printStackTrace();
}
Then when I changed to the Bindings tab I was able to choose EMF model elements, but only already existing and loaded dynamic instances.
So what if I don't want to use only the created ones but want to reference the model directly to use EMF data binding, would it be possible? Is my approach OK in the first place?
Thanks a lot!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03654 seconds