|Re: Ho can I get x and y in layoutConstraint in representations.aird from a session? [message #1830944 is a reply to message #1830942]
||Fri, 07 August 2020 07:12
|| Pierre-Charles David
Registered: July 2009
A given semantic object can have any number of representations inside a session; it can appear on different diagrams (or none), and even on a specific diagram there can be multiple graphical elements which point to the same semantic object.|
Assuming you know which specific diagram element you are looking for, the general process is:
* Find all DDiagramElements which point to your target: new org.eclipse.sirius.business.api.query.EObjectQuery(semanticElement).getInverseReferences(ViewpointPackage.Literals.DSEMANTIC_DECORATOR__TARGET)
* Filter the result to find *the* diagram element you are interested in (as mentioned above, there can be 0, 1, or several, including inside a given DDiagram.
* LayoutConstraint is not defined by Sirius, but by GMF, so your need to find the GMF View elements whose view.getElement() points to the diagramElement identified above. Same idea: new org.eclipse.sirius.business.api.query.EObjectQuery(diagramElement).getInverseReferences(NotationPackage.Literals.VIEW__ELEMENT)
* Finally you should obtain a GMF Notation View (in particular a Node), on which you can do node.getLayoutConstraint();
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
Powered by FUDForum
. Page generated in 0.02322 seconds