Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Custom Save
Custom Save [message #1002287] Fri, 18 January 2013 10:17 Go to next message
Lars Schulte is currently offline Lars SchulteFriend
Messages: 4
Registered: December 2012
Junior Member
Hi,

is it possible to change the save behavior of Graphiti? As far as I can tell Graphiti saves its diagram as an xmi file. Thats fine so far, but what im looking for is the possibility to save several diagrams into a single xmi file.
Any ideas?

Greetings
Lars
Re: Custom Save [message #1002329 is a reply to message #1002287] Fri, 18 January 2013 12:11 Go to previous message
Aljoscha Hark is currently offline Aljoscha HarkFriend
Messages: 24
Registered: March 2012
Junior Member
Hi,

you can do it easily:

- when doing it from within an already opened diagram, just do it by
Diagram diagram1 = ...; // the already opened diagram
Diagram diagram2 = ...; // the additional diagram
diagram1.eResource().getContents().add(diagram2); // do it inside a feature/write transaction

- when doing it "on load", e.g. from a context menu handler on a file
Diagram diagram = ...; // the additional diagram

String path = "/project/file.diagrams";
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = resourceSet.getResource(URI.createPlatformResource(path, true));
resource.getContents().add(diagram);
try {
   resource.save(Collections.emptyMap());
} catch(IOException e) {
   e.printStackTrace();
   // e.g. log error
}

greetings,
aljoscha
Previous Topic:new Diagram
Next Topic:Adding Root Domain Object on Diagram Creation
Goto Forum:
  


Current Time: Thu Apr 25 06:50:36 GMT 2024

Powered by FUDForum. Page generated in 0.03428 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top