Skip to main content



      Home
Home » Eclipse Projects » Sirius » How to create an editor/diagram editpart without opening it?
How to create an editor/diagram editpart without opening it? [message #1602293] Thu, 05 February 2015 07:55 Go to next message
Eclipse UserFriend
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


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 Go to previous messageGo to next message
Eclipse UserFriend
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 #1607980 is a reply to message #1602389] Mon, 09 February 2015 02:29 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, but when i checked, it seems no layout applied for the diagram/diagram element (x=0, y=0).

Thanh Huy LE
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Xcore dynamic instances support
Next Topic:Navigate Different Metamodels
Goto Forum:
  


Current Time: Fri May 16 23:49:41 EDT 2025

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

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

Back to the top