|(no subject) [message #687271]
||Thu, 26 May 2011 15:46
Originally posted by: <forums-noreply|
I'm relatively new to EMF apologies if this is a trivial problem and the solution is so obvious that I SHOULD have known it by myself.
Anyways here goes: my editor uses an EMF data model and I really like the idea of having JFace Viewers automatically synchronized with the model. The same applies for primitive SWT widgets which are not wrapped by JFace Viewers. So I got interested in EMF databindings. As WindowBuilder also supports this kind of binding, the first steps were smooth and I was really excited to see how it all just worked :)
However, I am searching for a solution to a problem related to databindings which is a little more complex than just mapping an EMF property to a SWT Text widget... The model looks like this:
I have an EMF Object Type A (lets call it parent) which has three ELists (maleChildren, femaleChildren, neutralChildren) containing objects of another type (Object Type B... let's call it child here). The piece of information I want to display at the UI (and potentially make editable in the future) is a mapped String which represents the EList the child is contained in (eg. display "Male Child" if its contained in the maleChildren Elist, "Female Child" if its contained in the femaleChildren Elist, and so on).
I've been reading here, that I need an IEMFListProperty to get the IObservableList for each of the ELists (see here: hxxp://tomsondev.bestsolution.at/2009/06/07/galileo-emf-databinding-part-2/). However, I don't really see how I can create a databinding with represents this containment-relationship of one child within three ELists...
I could create a databinding between the ELists and one of the properties of the specific child present but that's not what I want.
I'd like to create a binding between the ELists and the Child itself. Trying to directly set up a binding between each of the Elists and the Text Widget doesn't seem to be an option aswell. Within any potential validators or the converter of the databinding, I don't have the context of the binding (which is the child itself) so I can't decide weather or not it is contained inside the EList bound.
Any idea how to solve this using databindings?! Creating the mapped String manually is no big deal (from an initial implementation point of view). However model changes won't be reflected automatically and I'd need to manually refresh the SWT Text at the appropriate point in time (which can get really messy once Undo/Redo works fine). So the goal really is to realize this with EMF databindings. Any help is welcome. Thanks already.
Powered by FUDForum
. Page generated in 0.01324 seconds