Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:55 Go to next message
Huy Le is currently offline Huy LeFriend
Messages: 18
Registered: November 2014
Junior Member
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 14:29 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 505
Registered: May 2011
Senior Member
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


Steve Monnier - Obeo
Need training or 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 07:29 Go to previous messageGo to next message
Huy Le is currently offline Huy LeFriend
Messages: 18
Registered: November 2014
Junior Member
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 14:34 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 500
Registered: July 2009
Location: Nantes, France
Senior Member
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


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Xcore dynamic instances support
Next Topic:Navigate Different Metamodels
Goto Forum:
  


Current Time: Sat Feb 27 18:52:40 GMT 2021

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

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

Back to the top