|
Re: How to create an editor/diagram editpart without opening it? [message #1602389 is a reply to message #1602293] |
Thu, 05 February 2015 09:29   |
Eclipse User |
|
|
|
Hello,
To do so you need to use the service
DiagramEditPartService.createDiagramEditPart(...).
You can find a sample in DecoratorsTest.doInitGmfDiagram that uses it,
here is an exctract:
final Diagram gmfDiag = ViewService.createDiagram(diagram, "Sirius", new
PreferencesHint("Sirius"));
....
final DiagramEditPartService tool = new DiagramEditPartService();
final DiagramEditPart diagramEditPart =
tool.createDiagramEditPart(gmfDiag, shell, new PreferencesHint("DView"));
Regards,
Steve
Le 05/02/2015 13:55, Huy Le a écrit :
> Hello,
>
> As I know, Sirius provides us DialectUIManager.INSTANCE.openEditor() to
> open & return an IEditorPart.
>
> How can we retrieve the same IEditorPart object but not open the editor?
> I need it invisible to the user.
>
> Thanks,
>
> Huy Thanh LE
>
>
>
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: How to create an editor/diagram editpart without opening it? [message #1608459 is a reply to message #1607980] |
Mon, 09 February 2015 09:34  |
Eclipse User |
|
|
|
Hi Huy,
Le 09/02/2015 08:29, Huy Le a écrit :
> Thanks, but when i checked, it seems no layout applied for the
> diagram/diagram element (x=0, y=0).
I thing you might try to execute a
org.eclipse.sirius.diagram.ui.tools.internal.commands.InitializeLayoutCommand
on the created edit part to init the layout.
The helper indicated by Steve use a OffscreenEdtPartFactory which allows
you to create the edit part without showing it.
But you might have to init the GMF diagram between the part creation and
the layout initialization. If you did not use
DialectService.createRepresentation to create it, look into
org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices.createRepresentation(String,
EObject, RepresentationDescription, Session, IProgressMonitor) to see
how to init the GMF diagram.
>
> Thanh Huy LE
Regards,
--
Maxime - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Powered by
FUDForum. Page generated in 0.04452 seconds