we have a proprietary file format for our domain models, and I would like to be able to save the XSI Diagram/pictogram model directly in our file (not using EMF for domain model). Is there any way of doing this, subclassing the DiagramEditor and intercepting the save/load cycle?
while it is not a problem to use your own file format
and modeling techniques for your domain objects (business objects)
the pictogram model is tightly bound to EMF and its resource API.
I think it is very hard to decouple the pictogram model serialization
from EMF. I would rather try to supply the framework with a specific EMF resource
implementation which writes/reads the format you need.
thanks for reply - my problem is slightly different though (sorry for not being clear enough):
I already have a file format for my business objects, and want to use EMF:s serialisation of the pictogram model, but I want to be in control of this serialisation. To be specific: I want the pictogram XMI to be saved in a specific tag in my proprietary business object XML like so:
<my-xml-tag-for-bo>
..non-EMF business objects go here
</my-xml-tag-for-bo>
<graphiti-design>
..EMF pictogram XMI goes here
</graphiti-design>
Hope this makes my use case clearer. The reason I want to do things this way is that we already have other tools that read and save models in our proprietary format and I want to be able to continue using that format, with an extra tag for the graphiti pictogram EMF model.
Thanks for clarifying. Still, i think my answer is valid. You can write your own resource implementation which operates as you described.
You would have to adapt DiagramEditorInput and the Matching Strategy as well.
I did what you suggested and used my own Resource for the combination of Pictogram and model objects. For the record: I did not need to adapt the DiagramEditorInput, only create a resource factory for my resource and register it for my file extension with the resource factory registry.