Eclipse Platform
Release 3.0

org.eclipse.core.expressions
Class PropertyTester

java.lang.Object
  extended byorg.eclipse.core.expressions.PropertyTester
All Implemented Interfaces:
IPropertyTester

public abstract class PropertyTester
extends Object
implements IPropertyTester

Abstract superclass of all property testers. Implementation classes of the extension point org.eclipse.core.expresssions.propertyTesters must extend PropertyTester.

A property tester implements the property tests enumerated in the property tester extension point. For the following property test extension

   <propertyTester
     	 namespace="org.eclipse.jdt.core"
       id="org.eclipse.jdt.core.IPackageFragmentTester"
       properties="isDefaultPackage"
       type="org.eclipse.jdt.core.IPackageFragment"
       class="org.eclipse.demo.MyPackageFragmentTester">
     </propertyTester>
 
the corresponding implemenation class looks like:
   public class MyPackageFragmentTester {
       public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
           IPackageFragment fragement= (IPackageFragment)receiver;
	         if ("isDefaultPackage".equals(method)) { 
               return fragement.isDefaultPackage();
           }
           Assert.isTrue(false);
           return false;
       }
   }
 
The property can then be used in a test expression as follows:
   <instanceof value="org.eclipse.core.IPackageFragment"/>
   <test property="org.eclipse.jdt.core.isDefaultPackage"/>
 

Since:
3.0

Constructor Summary
PropertyTester()
           
 
Method Summary
 boolean handles(String namespace, String property)
          Returns whether the property tester can handle the given property or not.
 IPropertyTester instantiate()
          Loads the implementation class for this property tester and returns an instance of this class.
 org.eclipse.core.internal.expressions.PropertyTesterDescriptor internalCreateDescriptor()
          Note: this method is for internal use only.
 void internalInitialize(org.eclipse.core.internal.expressions.PropertyTesterDescriptor descriptor)
          Initialize the property tester with the given name space and property.
 boolean isDeclaringPluginActive()
          Returns true if the implementation class of this property tester can be loaded. This is the case if the plug-in providing the implementation class is active. Returns false otherwise.
 boolean isInstantiated()
          Returns whether the implementation class for this property tester is loaded or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.expressions.IPropertyTester
test
 

Constructor Detail

PropertyTester

public PropertyTester()
Method Detail

internalInitialize

public final void internalInitialize(org.eclipse.core.internal.expressions.PropertyTesterDescriptor descriptor)
Initialize the property tester with the given name space and property.

Note: this method is for internal use only. Clients must not call this method.

Parameters:
descriptor - the descriptor object for this tester

internalCreateDescriptor

public final org.eclipse.core.internal.expressions.PropertyTesterDescriptor internalCreateDescriptor()
Note: this method is for internal use only. Clients must not call this method.

Returns:
the property tester descriptor

handles

public final boolean handles(String namespace,
                             String property)
Returns whether the property tester can handle the given property or not.

Specified by:
handles in interface IPropertyTester
Parameters:
namespace - the name space to be considered
property - the property to test
Returns:
true if the tester provides an implementation for the given property; otherwise false is returned

isInstantiated

public final boolean isInstantiated()
Returns whether the implementation class for this property tester is loaded or not.

Specified by:
isInstantiated in interface IPropertyTester
Returns:
trueif the implementation class is loaded; false otherwise

isDeclaringPluginActive

public boolean isDeclaringPluginActive()
Returns true if the implementation class of this property tester can be loaded. This is the case if the plug-in providing the implementation class is active. Returns false otherwise.

Specified by:
isDeclaringPluginActive in interface IPropertyTester
Returns:
whether the implementation class can be loaded or not

instantiate

public final IPropertyTester instantiate()
Loads the implementation class for this property tester and returns an instance of this class.

Specified by:
instantiate in interface IPropertyTester
Returns:
an instance of the implementation class for this property tester

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.