Community
Participate
Working Groups
Overview: I am currently working on upgrading a custom Eclipse RCP based application from eclipse 3.8 to 4.5.1. We use AbstractContributionFactory extensively to create custom, dynamic menus(with sub-menus). When a Factory adds a MenuManager to the IContributionRoot with a visibleWhen Expression then the Expression is ignored and the menu is always visible. Steps to Reproduce: The attached plugin uses an AbstractContributionFactory to contribute an "Invisible" menu item to the main eclipse menu. This menu item has a visibleWhen expression that is always false so it should never appear. The expected behavior is seen in Eclipse 3.8 where the menu is never displayed. The error occurs in eclipse 4.5.1 where the menu is always displayed. Analysis: I have traced the problem into the eclipse plugins and I believe I understand the problem. It originates in the ContributionFactoryGenerator which creates an MMenuElement to represent any contribution item. When the visibleWhen Expression is evaluated it correctly updates the MMenuElement but when that event is processed in MenuManagerRenderer.toBeRenderedUpdater the visibility is not applied to the MenuManager. That method only applies visibility to MMenuElement which are rendered using an instanceof ContributionItem. It seems like if the ContributionFactoryGenerator was creating an MMenu for the MenuManager instead of an MMenuElement then the MenuManagerRenderer could process the visibility successfully.
Created attachment 258591 [details] Simple plugin which illustrates the issue
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
This is still an issue and our previous workaround is no longer working. In the 4.16 version of MenuManagerRender.subscribeUIEleemntTopicVisibility() at line 206, perhaps the check should be whether obj is an instanceof IContributionItem instead of just ContributionItem. This is breaking our application and we would like to see this bug reopened and addressed.
Ron, could you provide a Gerrit?
(In reply to Lars Vogel from comment #4) > Ron, could you provide a Gerrit? I cannot. The suggestion I previously mentioned will not resolve the issue as MenuManagerRender.subscribeUIEleemntTopicVisibility() is not even being called to update the visibility of our menus so the change to the instanceof check would not help.
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/169595