Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to reuse the same layout provider recursively on a diagram
How to reuse the same layout provider recursively on a diagram [message #1766017] Wed, 14 June 2017 19:10 Go to next message
Chris Mamorella is currently offline Chris MamorellaFriend
Messages: 34
Registered: June 2013
Member
I have a model which contains recursive elements. For example, a container of elements which themselves can be containers.

I have a layout algorithm to arrange the children in any given container, but I would like to be able to reapply the same layout to each child as well.

From the diagram user end, I could accomplish this by selecting the deepest child container first and applying "arrange all" on that selection. Then reapplying on the parent container and so forth all containers have been touched.

Is there a layout provider scheme that supports this notion of walking through the diagram parts and recursively applying the same layout provider depending on the part type? "Arrange all" only provides 1 selection by default (the root edit part of the diagram), so that's the use case I'd prefer to work with.

Re: How to reuse the same layout provider recursively on a diagram [message #1766241 is a reply to message #1766017] Mon, 19 June 2017 08:26 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Hi,

There is no direct support for this, but if your algorithm is invoked from the diagram's root edit, you should be able to walk inside the diagram's recursive structure by yourself and invoke your algorithm on each relevant container.

You'll need to use EditPart.getChildren() to walk inside the structure. Sirius EditParts are all instances of org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramElementEditPart, from which you can easily obtain the underlying semantic element (resolveTargetSemanticElement) and the Sirius graphical element (resolveDiagramElement). From a DDiagramElement, getMapping() will tell you what kind of element it corresponds to in your VSM. From all this you should be able to determine on which edit parts your algorithm should be invoked.

Regards,
Pierre-Charles David


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:[ANN] SiriusCon 2017
Next Topic:Appending Auto-Size to a custom arrange-all
Goto Forum:
  


Current Time: Wed Apr 24 19:44:54 GMT 2024

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

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

Back to the top