Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Dynamic popup menus(How to create a dynamically populated popup)
Dynamic popup menus [message #825935] Wed, 21 March 2012 12:42 Go to next message
Phill Perryman is currently offline Phill PerrymanFriend
Messages: 214
Registered: July 2009
Senior Member
I have a need to dynamically populate a popup based on the content and not the class of a selection. I would have used code like

MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
manager.add(new SomeAction());
}
});
Menu menu = menuMgr.createContextMenu(viewer.getTree());
viewer.getTree().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);

What is the equivalent of getSite() to register the context menu so it pops up. I can't define the content in the model editor. I looked at the EMenuService but it only seems to allow model defined menus.
Re: Dynamic popup menus [message #825938 is a reply to message #825935] Wed, 21 March 2012 12:45 Go to previous messageGo to next message
Phill Perryman is currently offline Phill PerrymanFriend
Messages: 214
Registered: July 2009
Senior Member
OK Scratch that as it appears to popup with the getSite call commented out. I ask myself why I had it in the old 3.x code.
Re: Dynamic popup menus [message #826077 is a reply to message #825938] Wed, 21 March 2012 16:17 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
IIRC without it you'd not been able to contribute to through the plugin.xml.

Tom

Am 21.03.12 13:45, schrieb Phill Perryman:
> OK Scratch that as it appears to popup with the getSite call commented
> out. I ask myself why I had it in the old 3.x code.
Re: Dynamic popup menus [message #826560 is a reply to message #826077] Thu, 22 March 2012 08:13 Go to previous message
Phill Perryman is currently offline Phill PerrymanFriend
Messages: 214
Registered: July 2009
Senior Member
Thanks, mine is an RCP app so I don't need to allow extensions to the menu.
Previous Topic:Layout in eclipse perspective
Next Topic:Coloring the trim on a CTabFolder
Goto Forum:
  


Current Time: Thu Apr 25 00:51:12 GMT 2024

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

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

Back to the top