Skip to main content



      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 16:59 Go to next message
Eclipse UserFriend
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 01:22 Go to previous messageGo to next message
Eclipse UserFriend
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 01:28 Go to previous messageGo to next message
Eclipse UserFriend
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 04:30 Go to previous messageGo to next message
Eclipse UserFriend
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 17:52 Go to previous messageGo to next message
Eclipse UserFriend
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 07:09 Go to previous messageGo to next message
Eclipse UserFriend
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 09:13 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 06:37:13 EDT 2025

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

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

Back to the top