Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Adding a new context menu (not items to an existing)
Adding a new context menu (not items to an existing) [message #431847] Tue, 24 May 2005 19:45 Go to next message
Nathan Sweet is currently offline Nathan SweetFriend
Messages: 24
Registered: July 2009
Junior Member
This is a simple question, but I haven't found anything at all about it. I know
how to add items to existing RCP menus, but how should I create my own context
menus in my 3.1 RCP app? These menus will be used for my controls.

For example, I have a TableViewer. Should I go down to SWT and use
viewer.getTable().setMenu(...)? Is there a JFace way to do it? Is there an RCP
way to do it, maybe that will all me to use extensions to add extra items? I
would like to choose the most powerful approach and do it right from the
beginning.

Thanks!

-Nate
Re: Adding a new context menu (not items to an existing) [message #463862 is a reply to message #431847] Sat, 17 February 2007 20:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gunislj.yahoo.com

I have the same question, please :(
Anybody knows?. I have example that hooks context menu trough the code (
hookContextMenu() ), which is bad. I want to create complete context menu
(and actions trough plugin.xml) and not trough code. HOW?
Thanks in advance, Lazar

"Nathan Sweet" <misc@n4te.com> wrote in message
news:d700e1$n1v$1@news.eclipse.org...
> This is a simple question, but I haven't found anything at all about it. I
> know
> how to add items to existing RCP menus, but how should I create my own
> context
> menus in my 3.1 RCP app? These menus will be used for my controls.
>
> For example, I have a TableViewer. Should I go down to SWT and use
> viewer.getTable().setMenu(...)? Is there a JFace way to do it? Is there an
> RCP
> way to do it, maybe that will all me to use extensions to add extra items?
> I
> would like to choose the most powerful approach and do it right from the
> beginning.
>
> Thanks!
>
> -Nate
>
>
Re: Adding a new context menu (not items to an existing) [message #463883 is a reply to message #463862] Mon, 19 February 2007 16:15 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You must always create the context menu through code at least once.
Then if you only want to add actions to it, you just add your actions
while your createPartControl(*) is called.

Then, if you want to allow plugin.xml contributions to it, you call
getSite().registerContextMenu(*) with appropriate parameters. You can
do all of your actions through plugin.xml, but you still have to
instantiate the MenuManager, attach it to the control, and call
registerContextMenu(*).

Later,
PW


Previous Topic:Discouraged accesses - consequences?
Next Topic:Can Eclipse RCP produce a web interface too?
Goto Forum:
  


Current Time: Wed Apr 24 19:14:27 GMT 2024

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

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

Back to the top