|
|
|
|
Re: Programmatically navigate and export Diagram to PNG file [message #1009737 is a reply to message #1009704] |
Fri, 15 February 2013 16:03 |
Gabriele Pongelli Messages: 9 Registered: February 2013 |
Junior Member |
|
|
I've ecorediag file having more than one diagram inside it, similar to
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation">
<notation:Diagram xmi:id="_TnwF0HeGEeKGu7kx0XPfRQ" type="EcoreTools" name="first.ecorediag" measurementUnit="Pixel">
<children xmi:type="notation:Node" xmi:id="_ToOm8HeGEeKGu7kx0XPfRQ" type="1001">
...
<edges xmi:type="notation:Edge" xmi:id="_To-N0neGEeKGu7kx0XPfRQ" type="3002" source="_ToOm8HeGEeKGu7kx0XPfRQ" target="_TowLbneGEeKGu7kx0XPfRQ">
...
</edges>
</notation:Diagram>
<notation:Diagram xmi:id="_VuV-4HeGEeKGu7kx0XPfRQ" type="EcoreTools" name="test.ecorediag" measurementUnit="Pixel">
<children xmi:type="notation:Node" xmi:id="_WQXG0HeGEeKGu7kx0XPfRQ" type="1001">
...
</children>
<edges xmi:type="notation:Edge" xmi:id="_W85csHeGEeKGu7kx0XPfRQ" type="3003" source="_W8raQHeGEeKGu7kx0XPfRQ" target="_WQXG0HeGEeKGu7kx0XPfRQ">
..
</edges>
</notation:Diagram>
</xmi:XMI>
As you can see, there are two diagram "first.ecorediag" and "test.ecorediag", I can see them from Outline view of ecorediag editor.
I wish save them separately, so I need one of them at time to load and, after that, use CopyToImageDialog class.
I've tried IDE.openEditor(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
new URIEditorInput(URI.createFileURI(ecoreDiagramFilepath),
EcoreDiagramEditor.ID);
with this code I can open ecorediag file showing "first.ecorediag" but I can't open "test.ecorediag" .
Another test I've done was about use NavigationManager, returned by EcoreDiagramEditor, to call its next() method, but after opening the editor on first.ecorediag, this method does anything.
I could call NavigationManager.set() but I need a Diagram object, that I don't know how I can obtain from ecorediag file.
EcoreDiagramOutlinePage, to loead other selected diagram, does ((EcoreDiagramEditor) getEditor()).setDiagram((Diagram) selectedObject);
Again I don't know how to obtain an object from ecorediag file.
Thank you!
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04552 seconds