|Re: EMF and Maps [message #423130 is a reply to message #423128]
||Tue, 23 September 2008 15:43
| Ed Merks
Registered: July 2009
The Ecore model's EAnnotation.details is an example so you can look at
how that works. If you simply treat an EMap as a plain old containment
EList, all the same concepts apply as for non-EMaps. Generally you'd use
add and remove commands to manipulate EMaps. The feature, owner, and
value are no different than any other non-EMap case. The only tricky
thing is that there's no strongly typed create method for the map entry
in the generated factory interface...
Luzi Anderegg wrote:
> thanks for your answer! I still have problems with maps and emf
> commands. do i have to use an addcommand or a setcommand? and what are
> the feature, the owner, and the value? do you have a sample for that?
> Ed Merks wrote:
>> Just treat it like a list and use
>> EcoreUtil.create(XyzPackage.Literals.<MapEntryClass>) to create the
>> instance you want to add. Cast the result of the creation to
>> BasicMap.Entry to set the key and value.
>> Luzi Anderegg wrote:
>>> I modelled a map in my ecore according to
>>> http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF .3F. Is
>>> there an example how to use such a map with an AddCommand from the
>>> generated edit plug-in?
>>> Gnerally, I did not find much information about modelling maps in
>>> EMF. Does somebody know some good pointers?
Powered by FUDForum
. Page generated in 0.02136 seconds