Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Automatic Generation of Diagrams.
Automatic Generation of Diagrams. [message #916833] Wed, 19 September 2012 14:25 Go to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

It happens I have quite big UML models generated from QVT transformation. I'd like to automatically get some diagrams for these models (i.e. one class diagram for each package showing the contained class, on diagram for each class depicting the class' relationships, etc.). Is there a way to automatically generate such diagrams (i.e. a QVT transformation from the UML model to the .di model, provided there is a meta-model for the .di file) ?

Thanks


Follow me on Twitter @andreasindico

Re: Automatic Generation of Diagrams. [message #916872 is a reply to message #916833] Wed, 19 September 2012 15:20 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hello Andrea,


A QVT transformation from UML to Notation+Di is technically possible, although very (very, very, very) complex to implement.

The best way is to programatically use "DropObjectsRequests" to simulate a drop of a semantic element to a diagram (Which results in displaying the element graphically). There's a tool in the Papyrus extra plug-ins which relies on this strategy to generate diagrams from a predefined template. See "Diagram generation" in the Papyrus additional components, or "extraplugins/diagramtemplate/oep.diagramtemplates.*" on the SVN repository if you're only interested in the implementation.

Here's the basic java code to drop an element in a diagram:

Element elementToShow = getElementToShow(); //The UML Element to drop
EditPart targetEditPart = getTargetEditPart(); //The GMF EditPart which is the drop target (e.g. diagram root)

DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(elementToShow);
dropObjectsRequest.setObjects(list);
dropObjectsRequest.setLocation(new Point(20, 100 * position));
Command commandDrop = editPart.getCommand(dropObjectsRequest); //The command is now ready to be executed



Regards,
Camille


Camille Letavernier
Re: Automatic Generation of Diagrams. [message #918547 is a reply to message #916872] Fri, 21 September 2012 05:36 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

Hai Camille,
thank you for your kind support. I have just installed the Diagram generator additional component and I am trying to use the diagram template. I have created a new template for a chosen model, selected class diagram from the model king box, selected Class and Package from the For box and Operation and Property from the What box (under the Class meta-class). When I execute the template it just creates a diagram for each class and package without actually filling its contents. It seems I am missing something of the diagram generation process. Is there any tutorial for that?

Regards


Follow me on Twitter @andreasindico

Re: Automatic Generation of Diagrams. [message #918622 is a reply to message #918547] Fri, 21 September 2012 07:18 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Andrea,

The diagram generation documentation is available on the Papyrus SVN repository:

http://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.papyrus/branches/0.9.X/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf


Regards,
Camille


Camille Letavernier
Re: Automatic Generation of Diagrams. [message #919249 is a reply to message #918622] Fri, 21 September 2012 20:53 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

Thank you Camille, It works fine and the pdf is clear.

Follow me on Twitter @andreasindico

Re: Automatic Generation of Diagrams. [message #963043 is a reply to message #918622] Mon, 29 October 2012 14:29 Go to previous message
Laya eng is currently offline Laya engFriend
Messages: 51
Registered: October 2012
Member
thank you so much Camille
Previous Topic:how to create a sequence diagram with time modeling
Next Topic:Papyrus and FUML
Goto Forum:
  


Current Time: Fri Mar 29 08:45:23 GMT 2024

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

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

Back to the top