Bug 112610 - [Contributions] viewerContributions to an empty submenu
Summary: [Contributions] viewerContributions to an empty submenu
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2005-10-14 06:21 EDT by Alin Alexandru CLA
Modified: 2016-11-10 13:12 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alin Alexandru CLA 2005-10-14 06:21:33 EDT
I wrote a plugin which extend "org.eclipse.ui.views". The view contains a
TreeViewer which have a context menu with an empty submenu. From other plugin I
make a viewerContribution to this context submenu. The context is not visible.
If I add from code an entry (action) in this context menu then the context menu
behave like expected (is visible).
I made some investigations in your code and found that viewerContributions to an
empty submenu(of an empty context menu) don't change the visibility of the menu.
So If my context menu contains only this empty submenu with some
viewerContributions then is not visible.
Comment 1 Douglas Pollock CLA 2005-10-14 10:25:08 EDT
Can you point me to the section of code where you think the problem is 
occurring? 
 
Comment 2 Alin Alexandru CLA 2005-10-14 12:28:18 EDT
I think the problem is that you add a SubContributionItem to an empty submenu of
an empty context menu (not visible), then make the item not visible too. This
problem occurs only if make a contribution to an empty submenu. I don't have a
solution yet but here is a copy/paste from my debug tree:

SubMenuManager.isVisible() line: 287 -> here set the SubMenuManager visibility
to false because there are no items except Separators
SubMenuManager.wrapMenu(IMenuManager) line: 391 ->here create a SubMenuManager -
 visible=false
SubMenuManager.getWrapper(IMenuManager) line: 244
SubMenuManager.find(String) line: 165
SubMenuManager.findUsingPath(String) line: 202
SubMenuManager.findMenuUsingPath(String) line: 179 -> return submenu (visible =
false)
..
PluginActionBuilder.contributeMenuAction(..) line: 329 - here call
insertAfter(..) line 353
..
PopupMenuExtender.addStaticActions(IMenuManager) line: 257
PopupMenuExtender.menuAboutToShow(IMenuManager) line: 274
MenuManager.fireAboutToShow(IMenuManager) line: 285
Comment 3 Andriy Rysin CLA 2005-10-28 14:40:57 EDT
I can confirm that, if I add the submenus to to viewerContribution they're not
shown unless I add an some action to menu in Java code. Adding separator does
not help.
Comment 4 Michael Van Meekeren CLA 2006-04-21 13:56:44 EDT
Moving Dougs bugs
Comment 5 Paul Webster CLA 2007-04-05 19:04:43 EDT
Assigning to component owner
PW
Comment 6 Mickael Istria CLA 2016-11-10 13:12:18 EST
Action, popupMenus and viewerContribution extensions are deprecated in favor of org.eclipse.ui.commands/org.eclipse.ui.menus. No work will be planned about actions.