I am trying to make a menu item active when a certain part becomes active. In e3 I used the activeEditorId. I have been trying to use the e4ActivePart variable but from looking at the code using it in an injection it always returns an MPart which in turn contains an object of the type I want.
So a core expression such as with="e4ActivePart" and an instanceOf="MyClass" does not work as the class is always org.eclipse.e4.ui.model.application.ui.basic.MPart.
is never true, I tried iterating over the active part in case it contained a collection of user classes.
is always true.
Is there another way to display a menu item only for certain parts.
That works fine for disabling but I don't want the handler menu item to be displayed at all so need to hide it with a visible when rather than have it showing but disabled. The can execute won't hide it only disable it. Given the number of different editors and commands I would have something like 25 disabled commands under a menu as opposed to 4-5 visible ones relevant to the editor in question. So I really need a core expression to control the visibility based on the active part.
I added it as a property tester in the manifest
<propertyTester class="swb3.PartPropertytester" id="swb3.PartPropertytester" namespace="swb3" properties="part" type="java.lang.Object">
I then created a definition for use by the menu
<test forcePluginActivation="true" property="swb3.part">