Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Create diagram programmatically from uml file
Create diagram programmatically from uml file [message #1795266] Wed, 19 September 2018 13:15 Go to next message
Ignacio Gómez is currently offline Ignacio GómezFriend
Messages: 1
Registered: September 2018
Junior Member
First of all, I'm sorry if this question is already answered somewhere, but I searched a lot and didn't found anything about that.

I want to know if there's any way to create a diagram programmatically (and be able to save it aftewards in a notation file) being that I already have an uml file with the description of the model.

In regard to the context of the question, I want to generate the graphical description of a model that was transformed with QVTo to UML2 from another model generated through Xtext. I have a Resource object from which I can get the model EObject (with the getContents function).

Thanks for your time.
Re: Create diagram programmatically from uml file [message #1795666 is a reply to message #1795266] Wed, 26 September 2018 14:03 Go to previous message
Quentin Le Menez is currently offline Quentin Le MenezFriend
Messages: 47
Registered: September 2014
Location: Paris Saclay, France
Hi Ignacio,

Sorry for the delay.
If you want to create it via papyrus, what you will need is, afaik, fairly complex but here are the pointers I can give you:
0- First of you will need to have a Papyrus editor opened
1- get the type of diagram you want to create and its associated ViewPrototype
2- create a ModelSet from the Papyrus MultiDiagramEditor through the service Registry
3- then create your diagram through a CreationCommandDescriptor.getComand().createDiagram(modelset, root, diagramName)
4- from there you will need to get from the editor its associated ServiceRegistry, TransactionalEditingDomain and Diagram page.
5- open the created diagram in it so as to be able to drop your elements in it through OpenDiagramCommand
6- drop your elements in the now active part through a drop request

you will then have your diagram created and populated. Although you won't have its elements organized so you might have to do a little cleanup by hand. Unless you want to use an automatic tool like ELK.

You can look at an example of this in the DiagramTemplate tool [1]. There should be a second release shortly but I have no time frame on it yet.


Previous Topic:Need Papyrus Sample Proect
Next Topic:Generation of Documentation
Goto Forum:

Current Time: Wed Jan 22 20:37:08 GMT 2020

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

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

Back to the top