Adding a new context menu (not items to an existing) [message #431847] |
Tue, 24 May 2005 15:45  |
Eclipse User |
|
|
|
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 11:15  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03091 seconds