I started working with Graphiti and try to build some modelling tools extensions for an existing eclipse environment.
Now I need to create a graphiti element based on the drag&drop from an existing viewer (displayes messages based on an own ecore model). After the drop of the "MessageElement" I only want to take the name of the viewer element and use it to create a new graphiti element including the resource/model data update.
Ater dropping the element I try to handle it with public IAddFeature getAddFeature(IAddContext context). So far everthing works but how to create a new element programmately similar to the palette create features. I tried several thing but often run into a runtime exception.
How to call create feature in the getAddFeature method?
Michael Wenz Messages: 1885 Registered: July 2009 Location: Walldorf, Germany
usually you would rather just return the add feature that can handle this situation in the getAddFeature method. Within that add feature you can then create the graphical representation and also eventually lacking domain model stuff (usually the semantics of drag&drop is that you already have something on domain model side and just need to create the graphical representation).
Not sure what exception you get but I could imagine that this is related to trying to create and and EMF objects outside of a EMF transaction, the transaction is available when you try that from within a feature.