|
Re: Get the representation name of a diagram [message #1740647 is a reply to message #1740327] |
Tue, 16 August 2016 11:47  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02444 seconds