Skip to main content



      Home
Home » Eclipse Projects » Sirius » How to get all Editparts from a Sirius Diagram
How to get all Editparts from a Sirius Diagram [message #1736798] Fri, 01 July 2016 16:04 Go to next message
Eclipse UserFriend
Hi all,

I want to perform some gmf requests (eg: Arrange all) programatically. I would need the Editparts (for the container Elements) of my Diagram. Is it possible to retrieve them from my
org.eclipse.sirius.diagram.DDiagram

and how do I accomplish that?
Respectively whats the proper way to access the Editparts of my Sirius Diagram?

I tried the following, but I'm kinda lost now:
DDiagramEditPart dDiagramEditPart = null;
	IEditorPart editor = EclipseUIUtil.getActiveEditor();
	if (editor instanceof DiagramEditor) {
	    DiagramEditor diagramEditor = (DiagramEditor) editor;
	    DiagramEditPart diagramEditPart = diagramEditor.getDiagramEditPart();
	    if (diagramEditPart instanceof DDiagramEditPart) {
		dDiagramEditPart = (DDiagramEditPart) diagramEditPart;
	    }
	}



Thank you,

Regards,
Matt

[Updated on: Fri, 01 July 2016 16:05] by Moderator

Re: How to get all Editparts from a Sirius Diagram [message #1736882 is a reply to message #1736798] Mon, 04 July 2016 03:52 Go to previous message
Eclipse UserFriend
I'll reproduce my answer to the same question on the GMF forum:

> I want to perform some gmf requests (eg: Arrange all)
> programatically. I would need the Editparts (for the container
> Elements) of my Diagram. Is it possible to retrieve them from my
> org.eclipse.sirius.diagram.DDiagram
> and how do I accomplish that?

It would be possible, but more cumbersome to navigate "backwards" from
the DDiagram to GMF's Diagram to the DiagramEditPart.

> Respectively whats the proper way to
> access the Editparts of my Sirius Diagram?
>
> I tried the following, but I'm kinda lost now:
> DDiagramEditPart dDiagramEditPart = null;
> IEditorPart editor = EclipseUIUtil.getActiveEditor();
> if (editor instanceof DiagramEditor) {
> DiagramEditor diagramEditor = (DiagramEditor) editor;
> DiagramEditPart diagramEditPart =
> diagramEditor.getDiagramEditPart();

From this DiagramEditPart, you can look at
org.eclipse.sirius.diagram.ui.tools.internal.layout.LayoutUtil.arrange(DiagramEditPart)

to launch the "Arrange All" action. It's technically internal, but only
a few lines of simple code, so you can reproduce it in your code without
worry.

Regards,
Pierre-Charles

--
Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Don't Auto arrange at Container creation
Next Topic:getting the attributes of the Eobject
Goto Forum:
  


Current Time: Wed Mar 26 11:28:02 EDT 2025

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

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

Back to the top