Project: Eclipse_Platform_UI
Bug 383815 <visibleWhen> has no effect for dynamic menu contributions
Reported: 2012-06-28 10:50:23 | Status: verified fixed

Build Identifier: I20120608-1400 I have popup menu extension which has custom property tester for controlling visibility. Reproducible: Always Steps to Reproduce: Let say: <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions"> <dynamic id="com.mycompany.menu" class="com.mycompany.TestMenu"> <visibleWhen> <reference definitionId="com.mycompany.selection"/> </visibleWhen> </dynamic> </menuContribution> </extension> <extension point="org.eclipse.core.expressions.definitions"> <definition id="com.mycompany.selection"> <with variable="selection"> <count value="1"/> <iterate> <adapt type="org.eclipse.core.resources.IProject"> <and> <test property="org.eclipse.core.resources.open" value="true"/> <test property="com.mycompany.matchesPattern" forcePluginActivation="true"/> </and> </adapt> </iterate> </with> </definition> </extension> <extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester id="com.mycompany.propertyTester" type="org.eclipse.core.resources.IProject" namespace="com.mycompany" properties="matchesPattern" class="com.mycompany.TestMenuPropertyTester"> </propertyTester> </extension> package com.mycompany; import org.eclipse.core.expressions.PropertyTester; ... public class TestMenuPropertyTester extends PropertyTester{ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { ... return false; } } The problem is that property tester check is never called and my context menu contribution is always visible.Exactly the same code worked fine on older eclipse versions such as 3.7.2 but it's broken-down now.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java