Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 09:55 Go to next message
Emre T is currently offline Emre TFriend
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!
Re: Using EMF Data Binding with EMF models from separate projects [message #1070711 is a reply to message #1070602] Thu, 18 July 2013 14:18 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
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 14:21 Go to previous messageGo to next message
Emre T is currently offline Emre TFriend
Messages: 119
Registered: April 2013
Senior Member
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] Sun, 21 July 2013 01:08 Go to previous message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
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 Apr 19 20:13:39 GMT 2024

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

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

Back to the top