Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » RCP 3.7 popupmenu problem(how to create popup menu for a view without treeviewer or tableviewer using menucontribution)
RCP 3.7 popupmenu problem [message #1400405] Mon, 14 July 2014 02:36 Go to next message
Eclipse UserFriend
Hello everyone , i meet a problem. I use menuContribution to add a popupmenu for my view like this "popup:myviewID".
But in my view , when i use "getSite().registerContextMenu(menuManager, viewer)", i don't hava a treeviewer or a tableviewer.

Then i find this in google,
final MenuManager menuMgr = new MenuManager();
// menuMgr.setRemoveAllWhenShown(true);
// IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class);
// menuService.populateContributionManager(menuMgr, "popup:myviewID");
// parent.setMenu(menuMgr.createContextMenu(parent));
it did't work out.


I want to know how can i do ?(i know use action is ok, but i really want to use menucontribution+command+handler)
Thank you for your help! Very Happy
Re: RCP 3.7 popupmenu problem [message #1401451 is a reply to message #1400405] Tue, 15 July 2014 12:32 Go to previous messageGo to next message
Eclipse UserFriend
The registerContextMenu() method takes an ISelectionProvider, not a Viewer. JFace Viewers implement ISelectionProvider.

You'll need to create an SWT Menu and JFace MenuManager to manage that menu. You'll need to trigger that menu to be shown, if you don't associate it with a widget (as per SWT Snippets 238).

Brian.
Re: RCP 3.7 popupmenu problem [message #1401811 is a reply to message #1401451] Wed, 16 July 2014 01:39 Go to previous message
Eclipse UserFriend
thank you for your help.
I didn't hava a ISelectionProvider. So I tried to let my view implement this. But when i full this view with swt components like button combo so on. It didn't work again.
I guess that the view couldn't react the right mouse click .
So I replace this problem with "menu:myviewID".
It can work out! It adds a view menu to my view. Looks like cool!

Thanks a lot.

Tom

[Updated on: Wed, 16 July 2014 01:40] by Moderator

Previous Topic:e3: Using a view in 2 different perspectives...not sharing data
Next Topic:Error when reverting p2 update from installation history
Goto Forum:
  


Current Time: Wed Jul 23 16:01:30 EDT 2025

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

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

Back to the top