How to get all Editparts from a Sirius Diagram [message #1736798] |
Fri, 01 July 2016 16:04  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02862 seconds