I have managed to the develop a plugin implementing a graphical editor based on Graphiti for an example ECORE meta-model. I have also managed to change the file extension and relate the new extension to the Graphiti editor. Now I'd like to relate the Graphiti file to the file containing the model it represents so that when clicking on the diagram file the contents of the model are automatically loaded and graphically depicted.
What is the most appropriate point in the graphical editor plugin to load the resourceset of the model?
Michael Wenz Messages: 1483 Registered: July 2009 Location: Walldorf, Germany
not sure if I understood what you meant. So wrote that you managed to open
the diagram when double clicking on the diagram file (with changed
extension), so I guess you meant to write "open the diagram editor when
double clicking on a model file"?
In case that is what you meant, you can try to register your diagram editor
(your own subclass of the Graphiti diagram editor) as editor for the
extension of the model files and in the overridded init method in your
subclass check if the passed file editor input points to such a model file.
In case yes you might create a diagram for that model and a diagram editor
input object and set that as the input for the editor. DiagramEditor does
something similiar for passing a diagram file editor input which is changed
to DiagramEditorInput on setInput.