[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Enable the "export" of the diagram

Hello Cristian,

I do this in my editor: In my diagram I can right-click on my *.xxx-file, choose Export, choose my own Export-Wizard and then the data from the diagram is saved in two xml-files in my own xml-Format.

For that you need to build your own Wizard:
In the plugin.xml add the extension point "org.eclipse.ui.exportWizards".
Then I created 3 classes in ...diagram.part: An ExportWizard (extends Wizard implements IExportWizard), an ExportPage (extends WizardPage) and an ExportHandler (extends DefaultHandler).
On the ExportPage I ask the user for the file-paths (where he wants the two xml-files). The Wizard starts the Page, takes the file-paths and passes them to the Handler. The Handler is a SAX-Parser, which parses the gmf-file and creates on-the-fly two new DOM-Trees. The Wizard takes the ready DOM-Trees from the Handler, serializes them, puts them into Files and saves them in the FileSystem.


Have fun! ^^
Best wishes
Julia


Cristian Bertuccioli schrieb:
Hi,

I want to know if is possible to enable an "export" feature that save the instances of my model in a custom schema (preferably xml) instead of the *.xxx and *.xxx_diagram files.

Or, alternatively, if is possible to change the behavior of the function that "save" and "load" the instances of my model.


Regards, Cristian