Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to get from an EditPart to its Editor in Eclipse?
How to get from an EditPart to its Editor in Eclipse? [message #547188] Thu, 15 July 2010 20:59 Go to next message
SM is currently offline SM
Messages: 10
Registered: October 2009
Junior Member
I am writing an eclipse plug-in that extends editor. Inside the editor I put some EditParts. From some of these edit parts I need a reference to their encapsulating editor (so that for example, when clicking an instance of MyEditPart, I want to programmatically close the editor).

Please advise on the API to get from an EditPart instance to the Editor it is in.

Thanks.
Re: How to get from an EditPart to its Editor in Eclipse? [message #547236 is a reply to message #547188] Fri, 16 July 2010 05:22 Go to previous messageGo to next message
Andreas is currently offline Andreas
Messages: 5
Registered: May 2010
Junior Member
Am i right that you want to shutdown your Editor with an Editpart?
Re: How to get from an EditPart to its Editor in Eclipse? [message #547237 is a reply to message #547236] Fri, 16 July 2010 05:28 Go to previous messageGo to next message
SM is currently offline SM
Messages: 10
Registered: October 2009
Junior Member
Well, yes, I want to shut down my Editor using an EditPart, but this is just an example. I want to get from an EditPart to its Editor in order to do also other things, like showing a message with the id of the plug-in that contributed this editor (like the information I see in the eclipse plug-in spy). In general, part of the behavior of my EditPart depends on the editor it is currently in.

Also note, this should work also when the editor is not currently the active page.

Thanks for your help.
Re: How to get from an EditPart to its Editor in Eclipse? [message #550385 is a reply to message #547188] Fri, 30 July 2010 08:30 Go to previous messageGo to next message
salever  is currently offline salever
Messages: 3
Registered: July 2010
Junior Member
Note that Editor comes from "org.eclipse.ui.IWorkbenchPart", and EditPart comes from "org.eclipse.gef.EditPart". I think there is no direct connection between them. Maybe you can try a key-value way like MAP to connect them customizedly.
Re: How to get from an EditPart to its Editor in Eclipse? [message #550582 is a reply to message #547188] Fri, 30 July 2010 21:52 Go to previous messageGo to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
On 15/07/2010 21:59, SM wrote:
> I am writing an eclipse plug-in that extends editor. Inside the editor I
> put some EditParts. From some of these edit parts I need a reference to
> their encapsulating editor (so that for example, when clicking an
> instance of MyEditPart, I want to programmatically close the editor).
>
> Please advise on the API to get from an EditPart instance to the Editor
> it is in.
>
> Thanks.
>

If you are using a DefaultEditDomain in your editor then you can call
the following from EditPart:

IEditorPart part =
((DefaultEditDomain)getViewer().getEditDomain()).getEditorPa rt();
Re: How to get from an EditPart to its Editor in Eclipse? [message #773734 is a reply to message #547188] Mon, 02 January 2012 12:09 Go to previous messageGo to next message
Karthikeyan Missing name is currently offline Karthikeyan Missing name
Messages: 47
Registered: July 2011
Member
Hi,
Me too has been struck with the same issue, Have you got any solution, if so kindly reply me. Myself wants to open new editor while clicking on the editpart.

Thanks & Regards,
Karthikeyan.B
Re: How to get from an EditPart to its Editor in Eclipse? [message #778168 is a reply to message #547188] Wed, 11 January 2012 14:13 Go to previous message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2010-07-15 22:59, SM wrote:
> I am writing an eclipse plug-in that extends editor. Inside the editor I
> put some EditParts. From some of these edit parts I need a reference to
> their encapsulating editor (so that for example, when clicking an
> instance of MyEditPart, I want to programmatically close the editor).
>
> Please advise on the API to get from an EditPart instance to the Editor
> it is in.

You seem to assume that there exists a (general) 1:1 mapping between
EditPart and an Eclipse Editor, but this does not exist. If you have
your own specific configuration, where this guarantee holds, you need to
define this mapping manually. This is especially easy, once you have
your own MyEditPart, because you could store a reference to the Editor
(or maybe to an IEditorDescriptor to be able to open a new editor if
needed).

HTH & Greetings from Bremen,

Daniel Krügler
Previous Topic:GEF Collapse or Expand Shape Outline Issue
Next Topic:Bendpoint creation is hit or miss
Goto Forum:
  


Current Time: Thu Oct 23 18:42:53 GMT 2014

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

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