Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 16:01 Go to next message
Chambier Michel is currently offline Chambier MichelFriend
Messages: 1
Registered: August 2016
Junior Member
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 15:47 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
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


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
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: Fri Apr 26 20:37:25 GMT 2024

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

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

Back to the top