Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to programmatically create a context menu entry for arbitrary editors?
How to programmatically create a context menu entry for arbitrary editors? [message #520372] Thu, 11 March 2010 21:06 Go to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hello,
I'm currently working on a project which serves nice functionality for a
couple of editors. It can be theoretically used by editors which have
been generated with EMF, i.e. editors for editing models. Now you can
see the problem. I don't know which EMF generated editors are present at
implementation time. And if I knew it can happen that more editors will
be added in future. So I need a possibility to programmatically add a
context menu entry for every editor of my choice. I want to add a
listener in the selection service and determine where the selection took
place - if it is an (EMF generated) editor I want to add a context menu
entry. How can I achieve this?

best regards,
Gilbert
Re: How to programmatically create a context menu entry for arbitrary editors? [message #520496 is a reply to message #520372] Fri, 12 March 2010 10:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Does anyone have some ideas, hints or links?
Re: How to programmatically create a context menu entry for arbitrary editors? [message #520551 is a reply to message #520372] Fri, 12 March 2010 14:13 Go to previous messageGo to next message
Eclipse UserFriend
Adding a context menu in what way? At the SWT level? Using
getSite().registerContextMenu(*)? Is it for a ruler at the edge of your
editor, or per entry field in your editor?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm
Re: How to programmatically create a context menu entry for arbitrary editors? [message #520590 is a reply to message #520551] Fri, 12 March 2010 18:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hi Paul.

Am 12.03.2010 20:13, schrieb Paul Webster:
> Adding a context menu in what way? At the SWT level? Using
> getSite().registerContextMenu(*)? Is it for a ruler at the edge of your
> editor, or per entry field in your editor?
I desire to add entries directly in the context menu of editors - so I
target the second aspect you described.
Re: How to programmatically create a context menu entry for arbitrary editors? [message #520591 is a reply to message #520551] Fri, 12 March 2010 18:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

It would be sufficient for me if a selection in the editor is of a
specific type (e.g. EObject). Maybe it is possible to add a context menu
to a type?
Re: How to programmatically create a context menu entry for arbitrary editors? [message #520614 is a reply to message #520372] Sat, 13 March 2010 04:50 Go to previous message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Damn it, I recognized that I asked my question in the wrong newsgroup. I
intended to ask in eclipse.platform.pde. Can I move my help request anyhow?
Re: How to programmatically create a context menu entry for arbitrary editors? [message #520621 is a reply to message #520372] Sat, 13 March 2010 02:56 Go to previous message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

I could solve it in this way:

<extension
point="org.eclipse.ui.menus">
<menuContribution
class="MyMenuContributor"
locationURI="popup:org.eclipse.ui.popup.any?after=additions ">
</menuContribution>
</extension>

In MyMenuContributor I then can determine if to show my context menu
entries or not.
Previous Topic:Add VIEWS_SHORTLIST(id: viewsShortlist) in the org.eclipse.ui.menus extension
Next Topic:Programatically change icon of a tab in the TabbedPropertyView
Goto Forum:
  


Current Time: Mon Jun 23 06:23:43 EDT 2025

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

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

Back to the top