PropertyTester: Want to determine does my Project have my custom nature [message #882964] |
Thu, 07 June 2012 10:37  |
Eclipse User |
|
|
|
I have problem from restricting my label to be visible when i select some project in project explorer. I want it to be visible only when selected project doesnt have my custom nature using Property Tester (if u know some other, easier way im open for new solutions).
This is my property Tester extension point:
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="plugin.plugintests.ProjectNatureTester"
id="plugin.plugintests.natureTester"
namespace="my.plugintests"
properties="changeNature"
type="org.eclipse.core.resources.IResource">
</propertyTester>
</extension>
and this is how i use it:
<visibleWhen
checkEnabled="false">
<with
variable="activeMenuSelection">
<iterate
ifEmpty="false"
operator="or">
<test
property="my.plugintests.changeNature">
</test>
</iterate>
</with>
</visibleWhen>
***********************************************
*********************************************** Class implementation
***********************************************
protected static final String PROJECT_NATURE = "changeNature";
public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
// TODO Auto-generated method stub
System.out.println("Usao sam u test");
boolean temp;
if (!(receiver instanceof IResource)) {
temp = false;
System.out.println("Prvi IF: " + temp);
return temp;
}
if (property.equals(PROJECT_NATURE)) {
final IProject proj = (IProject) receiver;
try {
temp = proj != null && proj.isAccessible() && proj.hasNature(toString(expectedValue));
System.out.println("Drugi IF: " + temp);
return temp;
} catch (final CoreException e) {
temp = false;
System.out.println("Catch: " + temp);
return temp;
}
}
System.out.println("Krajnji return false");
return false;
}
The problem is also that i dont have any messages printed in my console... I also tryed with forcePluginActivation but it didnt help. Also tryed:
<test
property = "org.eclipse.core.resources.projectNature"
value = "id of my custom nature"
</test>
but it didnt want also to work.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.28602 seconds