Programmatically create popup [message #253838] |
Mon, 14 April 2008 07:25  |
Eclipse User |
|
|
|
Originally posted by: andymorton.btinternet.com
Hi,
I have a popup menu via a plugin extension.
I want to do some processing and add items to this menu whenever the
plugin runs / activates.
Is this possible? I only want to have the top level menu in the
plugin.xml, just to be a container...
All ideas welcome!
Regards,
Andrew
|
|
|
Re: Programmatically create popup [message #253897 is a reply to message #253838] |
Mon, 14 April 2008 16:26  |
Eclipse User |
|
|
|
You'll need code along the lines of:
MenuManager menuMgr = new MenuManager("#PopupMenu");
....
menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
That last line is important. Check out the comments on
registerContextMenu.
Also, read this:
http://www.eclipse.org/articles/article.php?file=Article-act ion-contribution/index.html
HTH,
Wayne
On Mon, 2008-04-14 at 11:25 +0000, Andrew Morton wrote:
> Hi,
>
> I have a popup menu via a plugin extension.
> I want to do some processing and add items to this menu whenever the
> plugin runs / activates.
>
> Is this possible? I only want to have the top level menu in the
> plugin.xml, just to be a container...
>
> All ideas welcome!
>
> Regards,
> Andrew
>
|
|
|
Powered by
FUDForum. Page generated in 0.07733 seconds