Skip to main content



      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] Fri, 23 October 2009 22:57 Go to next message
Eclipse UserFriend
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 09:38 Go to previous messageGo to next message
Eclipse UserFriend
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 10:46 Go to previous messageGo to next message
Eclipse UserFriend
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 12:34 Go to previous message
Eclipse UserFriend
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 12:46] by Moderator

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


Current Time: Wed Jul 16 15:07:36 EDT 2025

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

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

Back to the top