|
|
Re: How to duplicate a GMF diagram [message #1149741 is a reply to message #1142247] |
Tue, 22 October 2013 09:17 |
Philippe EUGENE Messages: 58 Registered: January 2011 |
Member |
|
|
Hello Christian,
Thanks for the link.
I used an other method to do this. Simply using String replacement, not very nice, but it's work for my need.
/** create the resource Diagram **/
Resource diagram = xxxDiagramEditorUtil.createDiagram(target, diagramURI, modelURI,
new NullProgressMonitor());
/** load the resource of the diagram to duplicate **/
Resource sourceDiagram = // here load the resource;
/** serialize the resource in a String and make the string replacement **/
...
OutputStream outputStream = new ByteArrayOutputStream();
try {
sourceDiagram.save(outputStream, null);
String xml = outputStream.toString();
xml = xml.replaceAll(".myExtension#" + source.getID(),".myExtension#" + target.getID());
xml = xml.replaceAll(source.getName(), target.getName());
...
save the new diagram resource
|
|
|
Powered by
FUDForum. Page generated in 0.02043 seconds