maybe someone can point me in the right direction with my problem:
Scenario:
I already have a XText based DSL that I want to enhance with a graphiti based editor. I followed the tutorial and implemented the whole "addFeature" thing so that I should be able to create diagrams for my existing model.
When I start my plugin I'm able to create a new diagram (so far so good).
But how do I add the currently existing model elements to my diagram. In the tutorial there is an "EClasses" tree under the example project root where I can add the classes to the diagram via drag and drop. How can I achieve this for my DSL?
My idea is to add the diagram elements from the models outline via drag and drop, but I don't know where to start?
Rob Cernich Messages: 40 Registered: September 2011
Member
Hey Christian,
I recommend creating update features for each model object that you expect to include in the diagram. Your root/diagram update feature should look for missing elements and add them. Likewise, it should look for shapes that have no related business object and delete those shapes.
the problem might be in the Xtext outline view. You might want to ask in the Xtext group if Drag from outline is supported. Note that the graphiti example uses the project explorer view.
Michael Wenz Messages: 1275 Registered: July 2009 Location: Walldorf, Germany
Senior Member
Christian,
Andreas correctly pointed out one side of this. Additionally, on the Graphiti editor side you might need to install an additional drop target listener to react on the drag & drop operation, depending on what the siurce delivers. Graphiti by default enables the drop from the project explorer but maybe not from th xtext outline. Drop target listeners are added in the init method of DiagramEditor.
I ended up with implementing a navigator content provider for the project view that displays the model tree. From there drag and drop to graphiti diagrams went out of the box.
Thanks for you help.