Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to create programatically a diagram file when we provide a model eobject.
how to create programatically a diagram file when we provide a model eobject. [message #493269] Sat, 24 October 2009 02:57 Go to next message
No real name is currently offline No real nameFriend
Messages: 5
Registered: October 2009
Junior Member
how to create programatically a diagram file when we provide a model eobject.


for example, i have a model eobject named transaction, which has some children and subchildren.Now i want to create an diagram file which has nodes and edges programatically through transaction eobject.I can use a stupid way by the strong coding, but it may be very troubled.

Is there any simple way to do this? for example some useful classes and methods.
Re: how to create programatically a diagram file when we provide a model eobject. [message #493481 is a reply to message #493269] Mon, 26 October 2009 13:38 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 5
Registered: October 2009
Junior Member
Some body can help me ?

Thank you!
Re: how to create programatically a diagram file when we provide a model eobject. [message #493937 is a reply to message #493481] Wed, 28 October 2009 14:46 Go to previous messageGo to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
No Real Name wrote on Mon, 26 October 2009 09:38
Some body can help me ?

Thank you!



Take a look at the XXXInitDiaramFileAction in your generated diagrams plugin.
I believe GMF is generating a diagram programmatically there.

Best,
Artur
Re: how to create programatically a diagram file when we provide a model eobject. [message #493989 is a reply to message #493269] Wed, 28 October 2009 16:34 Go to previous message
Olivier Marot is currently offline Olivier MarotFriend
Messages: 14
Registered: September 2009
Junior Member
Hi,

Check generated xxDiagramEditorUtil.
You should find a static method
createDiagram(URI diagramURI, URI modelURI, IProgressMonitor progressMonitor).

From here you just need to load the existing model instead of creating a new one.

Switching
final Resource modelResource = editingDomain.getResourceSet()
				.createResource(modelURI);
for :
final Resource modelResource = editingDomain.getResourceSet().
				getResource(modelURI, true);
and deleting :
attachModelToResource(model, modelResource);

should do the trick.

Or you can modify :
private static XXX createInitialModel() {
		return XXXFactory.eINSTANCE.createXXX();
	}
to return what you want.

[Updated on: Wed, 28 October 2009 16:46]

Report message to a moderator

Previous Topic:Issues with AOP in GMFGraph dynamic templates
Next Topic:eclipse.modeling.amalgam
Goto Forum:
  


Current Time: Sat Apr 27 03:09:48 GMT 2024

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

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

Back to the top