Note that there are some explanatory texts on larger screens.

plurals
  1. POPropertyTester: How to determine Project Type on right click?
    primarykey
    data
    text
    <p>I am able to check for a Project Type I want for e.g by using</p> <pre><code>&lt;instanceof value="org.eclipse.core.resources.IProject"/&gt; &lt;test property="org.eclipse.core.resources.projectNature" value="org.eclipse.wst.jsdt.core.jsNature"/&gt; </code></pre> <p>in my for a pop-up menu command and then display my menu entry accordingly. However, there are some complex conditions to be checked, I was therefore asked to use a Property Tester. Below is the plugin.xml extract:</p> <pre><code>&lt;with variable="selection"&gt; &lt;test forcePluginActivation="true" property="testWizard.propertyTester.checkFolder"/&gt; &lt;extension point="org.eclipse.core.expressions.propertyTesters"&gt; &lt;propertyTester class="testwizard.wizards.MyPropTester" id="MyPropTester" namespace="testWizard.propertyTester" properties="checkFolder" type="org.eclipse.core.resources.IProject"&gt; &lt;/propertyTester&gt; &lt;/extension&gt; </code></pre> <p>... and the PropertyTester java code:</p> <pre><code>package testwizard.wizards; import org.eclipse.core.internal.propertytester.ResourcePropertyTester; import org.eclipse.core.resources.IResource; @SuppressWarnings("restriction") public class MyPropTester extends ResourcePropertyTester { @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { IResource res = (IResource) receiver; if(res instanceof IProject) { return true; } return false; } } </code></pre> <p>I am pretty new to using Property Testers,I'd really appreciate it If someone could guide me where my mistakes are.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload