Community
Participate
Working Groups
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.
Has your plugin been activated? Does it make any difference if you use activeMenuSelection instead of selection in your with element? PW
Yes, BundleActivator.start method was called before I opened the context menu.I've set forcePluginActivation="true" to ensure eager activation of my plug-in.It doesn't matter if I use activeMenuSelection or selection unfortunately I've got the same problem.
CQ:WINDE4BLOCKING This issue is blocking Wind River's adoption of Eclipse 4.x - we're going to stay on 3.x until this is fixed.
*** Bug 387657 has been marked as a duplicate of this bug. ***
I am seeing the same issue in an IBM product. <menuContribution locationURI="popup:org.eclipse.ui.popup.any?before=additions"> <dynamic class="MyClass" id="MyId"> <visibleWhen checkEnabled="false"> // some property testing </visibleWhen> </dynamic> </menuContribution> This worked fine in eclipse 3.6.2. Not working at all in 4.2.1.
Created attachment 225470 [details] Proposed Fix
Released http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_2_maintenance&id=256fe7630c949f09c3d4f0f10242b7d05ca9b58d Thanx Paul, PW
Verified in 4.2.2 (M20130116-1800)
Verified in 4.3-I20130128-2000