Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to get all Editparts from a Sirius Diagram
How to get all Editparts from a Sirius Diagram [message #1736797] Fri, 01 July 2016 20:00 Go to next message
Matt Se is currently offline Matt SeFriend
Messages: 29
Registered: February 2016
Junior Member
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
Re: How to get all Editparts from a Sirius Diagram [message #1736880 is a reply to message #1736797] Mon, 04 July 2016 07:35 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Le 01/07/2016 22:00, Matt Se a écrit :
> Hi all,

Hi.

For information, if you have Sirius-specific questions the should be
posted in the Sirius forum: https://www.eclipse.org/forums/index.php/f/262/.

> 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 David

--
Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:LayoutManager add unwanted Border Lines between nested Rectangles
Next Topic:Add Element to parent, when an Element is added to child
Goto Forum:
  


Current Time: Thu Apr 25 02:05:45 GMT 2024

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

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

Back to the top