Skip to main content



      Home
Home » Eclipse Projects » WindowBuilder » Using EMF Data Binding with EMF models from separate projects
Using EMF Data Binding with EMF models from separate projects [message #1070602] Thu, 18 July 2013 05:55 Go to next message
Eclipse UserFriend
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!
Re: Using EMF Data Binding with EMF models from separate projects [message #1070711 is a reply to message #1070602] Thu, 18 July 2013 10:18 Go to previous messageGo to next message
Eclipse UserFriend
I don't see any way for WB to help you with that. You would need to write your data binding code by hand in that case.
Re: Using EMF Data Binding with EMF models from separate projects [message #1070714 is a reply to message #1070711] Thu, 18 July 2013 10:21 Go to previous messageGo to next message
Eclipse UserFriend
I see, how unfortunate. Well then I will have to be jumping into my code in that case.

Another question not directly with this situation, but is there a reason, that under the Binding tab EMF Data Binding sometimes shows up and sometimes don't? I don't know how reproducible that is, but it occurred to me from time to time.
Re: Using EMF Data Binding with EMF models from separate projects [message #1071724 is a reply to message #1070714] Sat, 20 July 2013 21:08 Go to previous message
Eclipse UserFriend
EMF Data Binding should be available any time EMF objects are defined within the current class.
Previous Topic:Does WB work with eclipse Kepler 4.3?
Next Topic:Swing - JPanel - Border Properties = Error
Goto Forum:
  


Current Time: Fri Jul 25 08:52:32 EDT 2025

Powered by FUDForum. Page generated in 0.05764 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top