Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » PropertyTester never gets called via menu visibleWhen(eclipse plugin development)
PropertyTester never gets called via menu visibleWhen [message #1862734] Sun, 24 December 2023 13:31
xingya li is currently offline xingya liFriend
Messages: 1
Registered: December 2023
Junior Member
I'd like to implement a custom propertytester for my custom pop-up menu item. Unfortunately it never actually gets called. Here are the plugin.xml parts and the class.

==================================================plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

<extension
point="org.eclipse.ui.commands">
<category
id="quicker.commands.category"
name="Sample Category">
</category>
<command
categoryId="quicker.commands.category"
name="New Form"
id="quicker.commands.sampleCommand">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="quicker.handlers.QuickerHandler"
commandId="quicker.commands.sampleCommand">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="quicker.commands.sampleCommand"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<menu
label="apprartus3">
<command
commandId="quicker.commands.sampleCommand"
style="push">
</command>
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.name"
value="true">
</test>
</adapt>
</with>
</visibleWhen>
</menu>
</menuContribution>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="quicker.tester.FolderPropertyTester"
id="quicker.propertyTester3"
namespace="org.eclipse.core.resources"
properties="name"
type="org.eclipse.core.resources.IResource">
</propertyTester>
</extension>

</plugin>
==================================FolderPropertyTester.java
package quicker.tester;

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IResource;

public class FolderPropertyTester extends PropertyTester {

@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
IResource resource = (IResource) receiver;
return resource.getType() == IResource.FOLDER;
}

}

=======================================
It seems that nerver the test method of the FolderPropertyTester class gets called.
Any help would be appreciated.
Previous Topic:Resolving Proxies in the manual mode
Next Topic:Detect User Inactivity and Logout (Eclipse RCP)
Goto Forum:
  


Current Time: Sat Apr 27 20:48:42 GMT 2024

Powered by FUDForum. Page generated in 0.02585 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top