Skip to main content



      Home
Home » Eclipse Projects » Sirius » Get the representation name of a diagram
icon5.gif  Get the representation name of a diagram [message #1740327] Thu, 11 August 2016 12:01 Go to next message
Eclipse UserFriend
Hello,

I am trying to retrieve the name of the current representation of a diagram, in a Java Service.

For the example of the "Family", the name given when you "right click" on "Family" and then "New Representation > New persons diagram".

In my Java service I have a "FamilyImpl" object, for example. I am not able to retrieve the name of the representation, but I have all others informations...

Any idea ?

Thank you in advance.
Re: Get the representation name of a diagram [message #1740647 is a reply to message #1740327] Tue, 16 August 2016 11:47 Go to previous message
Eclipse UserFriend
Hello,

First of all, I will just copy the reply from Axel Guckelsberger that was probably done using NNTP that is not synchronizing with the forum:
"Hi,

you can get the current representation in two steps:

1. retrieve current session from org.eclipse.sirius.business.api.session.SessionManager.INSTANCE.sessions
2. get list of representations from org.eclipse.sirius.business.api.dialect.DialectManager.INSTANCE.getAllRepresentations(session)

HTH
Axel "

Another solution, that should be more efficient, you can also retrieve the DDiagram by using the crossreference[1]:
Collection<EObject> result = new EObjectQuery(mySemanticElement).getInverseReferences(ViewpointPackage.Literals.DSEMANTIC_DECORATOR__TARGET);

This will give you the diagram element representing your semantic element. From this element, all you need to do is find the container that is a DRepresentation (here a DDiagram) and you will have the name of the diagram.

Regards,
Steve
[1]https://wiki.eclipse.org/Sirius/Cookbook
Previous Topic:Changing the edge mapping in a diagram extension
Next Topic:Does not show me the family tree on the Starter tutorial
Goto Forum:
  


Current Time: Wed Mar 26 05:02:23 EDT 2025

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

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

Back to the top