I have been reprogramming the code from the book and I am currently stuck in chapter 6.
I have my view (which is basicly the favorites view with a different name), the add- and show-commands are working, but the context menu makes me some troubles.
Limiting the visibility of the context menu works when I just check wether the selected element is an instance of IResource or IJavaElement, but when also using the propertyTester, it is not shown.
When my view is not open, it is visible, but only until I open the view or execute the add-command. After that, my menu item does not appear ever again and the propertyTester is never called (I added a System.out.println() to its method).
I have checked for misspellings over and over, tried alternative spellings and things like that, but I could not get it working.
Messing with the namespace (removing the namespace from the property-attribute of the test-node leaving just the name of the property) caused the menu item to be shown while eclipse reported a lot of related errors, so I guess the problem must be in the second code snippet.
Can you help me? Any help would be appreciated!
Here the snippets from the plugin.xml:
- Code: Select all
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<menu
label="Test Cases">
<command
commandId="com.mycompany.ta.menuintegration.commands.add"
icon="icons/sample.gif">
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<iterate
ifEmpty="false"
operator="or">
<and>
<or>
<instanceof
value="org.eclipse.jdt.core.IJavaElement">
</instanceof>
<instanceof
value="org.eclipse.core.resources.IResource">
</instanceof>
</or>
<test
property="com.mycompany.ta.menuintegration.notInPool">
</test>
</and>
</iterate>
</with>
</visibleWhen>
</command>
</menu>
</menuContribution>
- Code: Select all
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="com.mycompany.ta.menuintegration.propertyTester.PoolTester"
id="com.mycompany.ta.menuintegration.propertyTester"
namespace="com.mycompany.ta.menuintegration"
properties="isInPool, notInPool"
type="java.lang.Object">
</propertyTester>
</extension>