Community
Participate
Working Groups
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.
Can you point me to the section of code where you think the problem is occurring?
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
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.
Moving Dougs bugs
Assigning to component owner PW
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.