|Re: Putting it all together [message #667736 is a reply to message #667732]
||Sun, 01 May 2011 21:10
| Volker Wegert
Registered: July 2009
Am 01.05.11 21:57, schrieb Stuart Harper:|
> I'd like to use Graphiti to create an editor which ultimately outputs an
> XML file.
Just to clarify - the default file format used to store your EMF Ecore
model is XML-based. I assume that you need to create a different kind of
I'd recommed to keep the Ecore-based model because it's much easier to
simply generate the "target XML file" when saving the editor.
> -More of a problem is how to provide the functionality of saving the XML
> file. Does this go in Graphiti or elsewhere?
It should be possible to override the method doSave of the DiagramEditor
and add your own XML output to the editor. What method you choose to
create the XML file is up to you. If you use a "complete" workbench
instead of a RCP application, you could also use a builder - in this
case, you don't need to modify the editor at all because the logic to
create your XML file from the diagram file is encapsulated in the builder.
> -A little like the save issue, how do I import existing XML files?
I'd recommend an import wizard that creates the model file from your
existing XML files. How you read these files is again up to you (SAX,
DOM, whatever). You then create the corresponding EMF object (the
"business object", add it to the model file, then create an AddContext
and/or an AddConnectionContext to add the business object to the
diagram. You then pass this context to the feature provider method
addIfPossible (you can get the FP using
It's a bit complex, but I'd recommend starting with a simple import
and related sources), add some XML reading of your choice and dump the
contents to stderr / stdout. Then add the EMF model objects and use the
reflective editor to check whether that works. If you've got the
non-diagram stuff running, it's much easier to add the diagram creation.
* Volker Wegert * http://www.volker-wegert.de/contact *
Powered by FUDForum
. Page generated in 0.02029 seconds