[130338] Eclipse Core Expressions Property Testers not loaded on demand
diff --git a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs
index 0305c96..f7f583a 100644
--- a/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.core.expressions/.settings/org.eclipse.jdt.ui.prefs
@@ -1,5 +1,6 @@
-#Tue Dec 21 11:05:13 CET 2004
+#Sun Mar 12 19:33:48 CET 2006
 eclipse.preferences.version=1
 org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org.osgi;org.eclipse.core.runtime;org.eclipse.core.expressions;org.eclipse.core.internal.expressions;
 org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.importorder=java;javax;org.eclipse.core.runtime;org.eclipse.core.expressions;org.eclipse.core.internal.expressions;
+org.eclipse.jdt.ui.staticondemandthreshold=99
diff --git a/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd b/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd
index bdca18c..cfdea06 100644
--- a/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd
+++ b/bundles/org.eclipse.core.expressions/schema/expressionLanguage.exsd
@@ -140,8 +140,11 @@
          <documentation>
             This element is used to evaluate the property state of the object in focus. The set of
             testable properties can be extended using the propery tester extension point. The test
-            expression returns EvaluationResult.NOT_LOADED if teh property tester doing the actual
-            testing isn&apos;t loaded yet.
+            expression returns EvaluationResult.NOT_LOADED if the property tester doing the actual
+            testing isn&apos;t loaded yet and the attribute forcePluginActivation is set to false. 
+            If forcePluginActivation is set to true and the evaluation context used to evaluate
+            this expression support plug-in activation then evaluating the property will result in 
+            activating the plug-in defining the tester.
          </documentation>
       </annotation>
       <complexType>
@@ -186,6 +189,18 @@
                </documentation>
             </annotation>
          </attribute>
+         <attribute name="forcePluginActivation" type="boolean">
+            <annotation>
+               <documentation>
+                  a flag indicating whether the plug-in contributing the property tester
+                  should be loaded if necessary. As such, this flag should be used judiciously, 
+                  in order to avoid unnecessary plug-in activations. Most clients should avoid
+                  setting this flag to true. This flag is only honored if the evaluation context
+                  used to evaluate this expression allows plug-in activation. Otherwise the flag
+                  is ignored and no plug-in loading takes place.
+               </documentation>
+            </annotation>
+         </attribute>
       </complexType>
    </element>
 
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java
index bbdc973..98940ca 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationContext.java
@@ -32,6 +32,7 @@
 	private Object fDefaultVariable;
 	private Map/*<String, Object>*/ fVariables;
 	private IVariableResolver[] fVariableResolvers;
+	private boolean fAllowPluginActivation;
 	
 	/**
 	 * Create a new evaluation context with the given parent and default
@@ -91,6 +92,20 @@
 	/**
 	 * {@inheritDoc}
 	 */
+	public void setAllowPluginActivation(boolean value) {
+		fAllowPluginActivation= value;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean getAllowPluginActivation() {
+		return fAllowPluginActivation;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
 	public void addVariable(String name, Object value) {
 		Assert.isNotNull(name);
 		Assert.isNotNull(value);
@@ -141,4 +156,4 @@
 			return fParent.resolveVariable(name, args);
 		return null;
 	}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java
index 6f62a40..fdec6e9 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IEvaluationContext.java
@@ -43,6 +43,27 @@
 	public IEvaluationContext getRoot();
 	
 	/**
+	 * Specifies whether this evaluation context allows activation
+	 * of plug-ins for testers used in the expression tree. To actual
+	 * trigger the plug-in loading this flag has to be set to <code>
+	 * true</code> and the actual test expression must have the
+	 * attribute <code>forcePluginActivation</code> set to <code>
+	 * true</code> as well.
+	 * 
+	 * @param value whether this evaluation context allows plug-in
+	 *  activation
+	 */
+	public void setAllowPluginActivation(boolean value);
+	
+	/**
+	 * Returns whether this evaluation context supports plug-in 
+	 * activation.
+	 * 
+	 * @return whether plug-in activation is supported or not
+	 */
+	public boolean getAllowPluginActivation();
+	
+	/**
 	 * Returns the default variable.
 	 * 
 	 * @return the default variable or <code>null</code> if
@@ -94,4 +115,4 @@
 	 *  the variable
 	 */
 	public Object resolveVariable(String name, Object[] args) throws CoreException;
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java
index 7b537a3..708b35b 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/PropertyTester.java
@@ -10,12 +10,19 @@
  *******************************************************************************/
 package org.eclipse.core.expressions;
 
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.core.internal.expressions.PropertyTesterDescriptor;
-
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.core.internal.expressions.ExpressionMessages;
+import org.eclipse.core.internal.expressions.ExpressionPlugin;
+import org.eclipse.core.internal.expressions.Messages;
+import org.eclipse.core.internal.expressions.PropertyTesterDescriptor;
 
 /**
  * Abstract superclass of all property testers. Implementation classes of
@@ -85,6 +92,24 @@
 	public final PropertyTesterDescriptor internalCreateDescriptor() {
 		return new PropertyTesterDescriptor(fConfigElement, fNamespace, fProperties);
 	}
+	
+	/**
+	 * Note: this method is for internal use only. Clients must not call 
+	 * this method.
+	 * 
+	 * @throws CoreException if the plugin can't be activated
+	 */
+	public final void internalActivateDeclaringPlugin() throws CoreException {
+		String pluginName= fConfigElement.getContributor().getName();
+		Bundle bundle= Platform.getBundle(pluginName);
+		try {
+			bundle.start();
+		} catch (BundleException e) {
+			throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(), IStatus.ERROR,
+				Messages.format(ExpressionMessages.PropertyTester_error_activating_plugin, pluginName), 
+				e));
+		}
+	}
 
 	/**
 	 * {@inheritDoc}
@@ -104,8 +129,8 @@
 	 * {@inheritDoc}
 	 */
 	public boolean isDeclaringPluginActive() {
-		Bundle fBundle= Platform.getBundle(fConfigElement.getContributor().getName());
-		return fBundle.getState() == Bundle.ACTIVE;		
+		Bundle bundle= Platform.getBundle(fConfigElement.getContributor().getName());
+		return bundle.getState() == Bundle.ACTIVE;		
 	}
 	
 	/**
@@ -114,4 +139,4 @@
 	public final IPropertyTester instantiate() {
 		return this;
 	}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java
index 90ea311..a5edadb 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefaultVariable.java
@@ -64,6 +64,20 @@
 	public Object getDefaultVariable() {
 		return fDefaultVariable;
 	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public void setAllowPluginActivation(boolean value) {
+		fParent.setAllowPluginActivation(value);
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean getAllowPluginActivation() {
+		return fParent.getAllowPluginActivation();
+	}
 
 	/**
 	 * {@inheritDoc}
@@ -92,4 +106,4 @@
 	public Object resolveVariable(String name, Object[] args) throws CoreException {
 		return fManagedPool.resolveVariable(name, args);
 	}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java
index 67063b3..2939e60 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.java
@@ -27,14 +27,21 @@
 	public static String Expression_unknown_element;
 	public static String Expression_string_not_correctly_escaped;
 	public static String Expression_string_not_terminated;
+	
 	public static String TypeExtender_unknownMethod;
 	public static String TypeExtender_incorrectType;
+	
 	public static String TestExpression_no_name_space;
+	
 	public static String WithExpression_variable_not_defined;
+	
 	public static String ResolveExpression_variable_not_defined;
+	
 	public static String PropertyTesterDescriptor_no_namespace;
 	public static String PropertyTesterDescritpri_no_properties;
 
+	public static String PropertyTester_error_activating_plugin;
+	
 	static {
 		NLS.initializeMessages(BUNDLE_NAME, ExpressionMessages.class);
 	}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties
index 62d6a79..aaa154c 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionMessages.properties
@@ -31,3 +31,5 @@
 
 PropertyTesterDescriptor_no_namespace= The mandatory attribute namespace is missing. Tester has been disabled.
 PropertyTesterDescritpri_no_properties= The mandatory attribute properties is missing. Tester has been disabled.
+
+PropertyTester_error_activating_plugin=Internal error activating plug-in {0}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java
index b0f065c..0f1e951 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Expressions.java
@@ -89,6 +89,13 @@
 			Messages.format(ExpressionMessages.Expression_variable_not_a_list, expression.toString()))); 
 	}
 	
+	public static boolean getOptionalBooleanAttribute(IConfigurationElement element, String attributeName) {
+		String value= element.getAttribute(attributeName);
+		if (value == null)
+			return false;
+		return Boolean.valueOf(value).booleanValue();
+	}
+	
 	//---- Argument parsing --------------------------------------------
 	
 	public static final Object[] EMPTY_ARGS= new Object[0];
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java
index e74ed94..1036c0c 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/IterateExpression.java
@@ -44,6 +44,12 @@
 		public Object getDefaultVariable() {
 			return fDefaultVariable;
 		}
+		public boolean getAllowPluginActivation() {
+			return fParent.getAllowPluginActivation();
+		}
+		public void setAllowPluginActivation(boolean value) {
+			fParent.setAllowPluginActivation(value);
+		}
 		public void addVariable(String name, Object value) {
 			fParent.addVariable(name, value);
 		}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java
index 40dbb1e..6e9162c 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Property.java
@@ -43,9 +43,13 @@
 		return fTester.isDeclaringPluginActive();
 	}
 	
-	public boolean isValidCacheEntry() {
-		return 	(isInstantiated() && isDeclaringPluginActive()) ||
-				(!isInstantiated() && !isDeclaringPluginActive());
+	public boolean isValidCacheEntry(boolean forcePluginActivation) {
+		if (forcePluginActivation) {
+			return isInstantiated() && isDeclaringPluginActive();
+		} else {
+			return 	(isInstantiated() && isDeclaringPluginActive()) ||
+					(!isInstantiated() && !isDeclaringPluginActive());
+		}
 	}
  	
 	public boolean test(Object receiver, Object[] args, Object expectedValue) {
@@ -62,4 +66,4 @@
 	public int hashCode() {
 		return (fType.hashCode() << 16) | fNamespace.hashCode() << 8 | fName.hashCode();
 	}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java
index 415d9b0..c0f565a 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TestExpression.java
@@ -24,9 +24,11 @@
 	private String fProperty;
 	private Object[] fArgs;
 	private Object fExpectedValue;
+	private boolean fForcePluginActivation;
 	
 	private static final String ATT_PROPERTY= "property"; //$NON-NLS-1$
 	private static final String ATT_ARGS= "args"; //$NON-NLS-1$
+	private static final String ATT_FORCE_PLUGIN_ACTIVATION= "forcePluginActivation"; //$NON-NLS-1$
 	/**
 	 * The seed for the hash code for all test expressions.
 	 */
@@ -46,17 +48,23 @@
 		fProperty= property.substring(pos + 1);
 		fArgs= Expressions.getArguments(element, ATT_ARGS);
 		fExpectedValue= Expressions.convertArgument(element.getAttribute(ATT_VALUE));
+		fForcePluginActivation= Expressions.getOptionalBooleanAttribute(element, ATT_FORCE_PLUGIN_ACTIVATION);
 	}
 	
 	public TestExpression(String namespace, String property, Object[] args, Object expectedValue) {
+		this(namespace, property, args, expectedValue, false);
+	}
+	
+	public TestExpression(String namespace, String property, Object[] args, Object expectedValue, boolean forcePluginActivation) {
 		Assert.isNotNull(namespace);
 		Assert.isNotNull(property);
 		fNamespace= namespace;
 		fProperty= property;
 		fArgs= args != null ? args : Expressions.EMPTY_ARGS;
 		fExpectedValue= expectedValue;
+		fForcePluginActivation= forcePluginActivation;
 	}
-	
+
 	public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
 		Object element= context.getDefaultVariable();
 		if (System.class.equals(element)) {
@@ -65,7 +73,7 @@
 				return EvaluationResult.FALSE;
 			return EvaluationResult.valueOf(str.equals(fArgs[0]));
 		}
-		Property property= fgTypeExtensionManager.getProperty(element, fNamespace, fProperty);
+		Property property= fgTypeExtensionManager.getProperty(element, fNamespace, fProperty, context.getAllowPluginActivation() && fForcePluginActivation);
 		if (!property.isInstantiated())
 			return EvaluationResult.NOT_LOADED;
 		return EvaluationResult.valueOf(property.test(element, fArgs, fExpectedValue));
@@ -80,7 +88,8 @@
 			return false;
 		
 		final TestExpression that= (TestExpression)object;
-		return this.fNamespace.equals(that.fNamespace) && this.fProperty.equals(that.fProperty)
+		return this.fNamespace.equals(that.fNamespace) && this.fProperty.equals(that.fProperty) 
+			&& this.fForcePluginActivation == that.fForcePluginActivation
 			&& equals(this.fArgs, that.fArgs) && equals(this.fExpectedValue, that.fExpectedValue);
 	}
 
@@ -88,7 +97,8 @@
 		return HASH_INITIAL * HASH_FACTOR + hashCode(fArgs)
 			* HASH_FACTOR + hashCode(fExpectedValue)
 			* HASH_FACTOR + fNamespace.hashCode()
-			* HASH_FACTOR + fProperty.hashCode();
+			* HASH_FACTOR + fProperty.hashCode()
+			* HASH_FACTOR + (fForcePluginActivation ? 1 : 0);
 	}
 	
 	//---- Debugging ---------------------------------------------------
@@ -113,6 +123,17 @@
 		return "<test property=\"" + fProperty +  //$NON-NLS-1$
 		  (fArgs.length != 0 ? "\" args=\"" + args + "\"" : "\"") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		  (fExpectedValue != null ? "\" value=\"" + fExpectedValue + "\"" : "\"") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		  " plug-in activation: " + (fForcePluginActivation ? "eager" : "lazy") +   //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
 		  "/>"; //$NON-NLS-1$
 	}
+	
+	//---- testing ---------------------------------------------------
+	
+	public boolean testGetForcePluginActivation() {
+		return fForcePluginActivation;
+	}
+	
+	public static TypeExtensionManager testGetTypeExtensionManager() {
+		return fgTypeExtensionManager;
+	}
 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java
index 552262a..048d5f5 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtension.java
@@ -19,7 +19,7 @@
 	
 	private static final TypeExtension[] EMPTY_TYPE_EXTENSION_ARRAY= new TypeExtension[0];
 
-	/* a special property tester instance that used to signal that method searching has to continue */
+	/* a special property tester instance that is used to signal that method searching has to continue */
 	/* package */ static final IPropertyTester CONTINUE= new IPropertyTester() {
 		public boolean handles(String namespace, String method) {
 			return false;
@@ -40,7 +40,7 @@
 		
 	/* a special type extension instance that marks the end of an evaluation chain */
 	private static final TypeExtension END_POINT= new TypeExtension() {
-		/* package */ IPropertyTester findTypeExtender(TypeExtensionManager manager, String namespace, String name, boolean staticMethod) throws CoreException {
+		/* package */ IPropertyTester findTypeExtender(TypeExtensionManager manager, String namespace, String name, boolean staticMethod, boolean forcePluginActivation) throws CoreException {
 			return CONTINUE;
 		}
 	};
@@ -64,7 +64,7 @@
 		fType= type;
 	}
 	
-	/* package */ IPropertyTester findTypeExtender(TypeExtensionManager manager, String namespace, String method, boolean staticMethod) throws CoreException {
+	/* package */ IPropertyTester findTypeExtender(TypeExtensionManager manager, String namespace, String method, boolean staticMethod, boolean forcePluginActivation) throws CoreException {
 		if (fExtenders == null) {
 			fExtenders= manager.loadTesters(fType);
 		}
@@ -78,13 +78,15 @@
 			if (extender.isInstantiated()) {
 				if (extender.isDeclaringPluginActive()) {
 					return extender;
+				} else if (forcePluginActivation) {
+					
 				} else {
 					PropertyTester tester= (PropertyTester)extender;
 					fExtenders[i]= extender= tester.internalCreateDescriptor();
 					return extender;
 				}
 			} else {
-				if (extender.isDeclaringPluginActive()) {
+				if (extender.isDeclaringPluginActive() || forcePluginActivation) {
 					try {
 						PropertyTesterDescriptor descriptor= (PropertyTesterDescriptor)extender;
 						IPropertyTester inst= descriptor.instantiate();
@@ -120,7 +122,7 @@
 				fExtends= END_POINT;
 			}
 		}
-		result= fExtends.findTypeExtender(manager, namespace, method, staticMethod);
+		result= fExtends.findTypeExtender(manager, namespace, method, staticMethod, forcePluginActivation);
 		if (result != CONTINUE)
 			return result;
 		
@@ -137,10 +139,10 @@
 			}
 		}
 		for (int i= 0; i < fImplements.length; i++) {
-			result= fImplements[i].findTypeExtender(manager, namespace, method, staticMethod);
+			result= fImplements[i].findTypeExtender(manager, namespace, method, staticMethod, forcePluginActivation);
 			if (result != CONTINUE)
 				return result;
 		}
 		return CONTINUE;
 	}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java
index 0c839e8..6680be5 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/TypeExtensionManager.java
@@ -74,7 +74,11 @@
 		initializeCaches();
 	}
 
-	public synchronized Property getProperty(Object receiver, String namespace, String method) throws CoreException  {
+	public Property getProperty(Object receiver, String namespace, String method) throws CoreException  {
+		return getProperty(receiver, namespace, method, false);
+	}
+	
+	public synchronized Property getProperty(Object receiver, String namespace, String method, boolean forcePluginActivation) throws CoreException  {
 		long start= 0;
 		if (Expressions.TRACING)
 			start= System.currentTimeMillis();
@@ -84,7 +88,7 @@
 		Property result= new Property(clazz, namespace, method);
 		Property cached= fPropertyCache.get(result);
 		if (cached != null) {
-			if (cached.isValidCacheEntry()) {
+			if (cached.isValidCacheEntry(forcePluginActivation)) {
 				if (Expressions.TRACING) {
 					System.out.println("[Type Extension] - method " + //$NON-NLS-1$
 						clazz.getName() + "#" + method + //$NON-NLS-1$
@@ -99,7 +103,7 @@
 			fPropertyCache.remove(cached);
 		}
 		TypeExtension extension= get(clazz);
-		IPropertyTester extender= extension.findTypeExtender(this, namespace, method, receiver instanceof Class);
+		IPropertyTester extender= extension.findTypeExtender(this, namespace, method, receiver instanceof Class, forcePluginActivation);
 		if (extender == TypeExtension.CONTINUE || extender == null) {
 			throw new CoreException(new ExpressionStatus(
 				ExpressionStatus.TYPE_EXTENDER_UNKOWN_METHOD,
diff --git a/tests/org.eclipse.core.expressions.tests/plugin.xml b/tests/org.eclipse.core.expressions.tests/plugin.xml
index 6c8d337..79380dc 100644
--- a/tests/org.eclipse.core.expressions.tests/plugin.xml
+++ b/tests/org.eclipse.core.expressions.tests/plugin.xml
@@ -104,6 +104,7 @@
             <test property="namespace.isDefault"/>
             <test property="namespace.isDefault" value="default"/>
             <test property="namespace.isDefault" args="'arg1', 'arg2'" value="default"/>
+            <test property="namespace.isDefault" forcePluginActivation="true"/>
 	        <systemTest property="isDefault" value="xx"/>
 	        <equals value= "string"/>
             <count value="1"/>
@@ -166,5 +167,16 @@
             </iterate>
       </enablement>
      </testParticipant>
-   </extension>
+    </extension>
+    
+	<extension point="org.eclipse.core.expressions.tests.testParticipants">
+	  <testParticipant id="test2">
+		<enablement>
+            <test property="namespace.isDefault" forcePluginActivation="true"/>
+            <test property="namespace.isDefault" forcePluginActivation="false"/>
+            <test property="namespace.isDefault"/>
+      	</enablement>
+      </testParticipant>
+   	</extension>
+   	 
 </plugin>
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
index bfc20b4..4b0dd55 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
@@ -22,5 +22,4 @@
 		suite.addTest(ExpressionInfoTests.suite());
 		return suite;
 	}
-}
-
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
index fae4887..edce543 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
@@ -652,6 +652,22 @@
 		Expression exp= ExpressionConverter.getDefault().perform(enable);
 		ref(exp);
 	}
+	
+	public void testForcePluginActivation() throws Exception {
+		IExtensionRegistry registry= Platform.getExtensionRegistry();
+		IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
+		
+		IConfigurationElement enable= findExtension(ces, "test2").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
+		EnablementExpression exp= (EnablementExpression) ExpressionConverter.getDefault().perform(enable);
+		Expression[] children= exp.getChildren();
+		assertTrue(children.length == 3);
+		TestExpression test= (TestExpression) children[0];
+		assertTrue(test.testGetForcePluginActivation());
+		test= (TestExpression) children[1];
+		assertTrue(!test.testGetForcePluginActivation());
+		test= (TestExpression) children[2];
+		assertTrue(!test.testGetForcePluginActivation());
+	}
 
 	private IConfigurationElement findExtension(IConfigurationElement[] ces, String id) {
 		for (int i= 0; i < ces.length; i++) {
@@ -662,6 +678,5 @@
 	}
 	
 	protected void ref(Expression exp) {
-		
 	}
-}
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java
index 6eca6b3..23f9f98 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/PropertyTesterTests.java
@@ -17,7 +17,11 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.Platform;
 
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.expressions.EvaluationResult;
+
 import org.eclipse.core.internal.expressions.Property;
+import org.eclipse.core.internal.expressions.TestExpression;
 import org.eclipse.core.internal.expressions.TypeExtensionManager;
 
 import org.osgi.framework.Bundle;
@@ -30,6 +34,9 @@
 
 	private static final TypeExtensionManager fgManager= new TypeExtensionManager("propertyTesters"); //$NON-NLS-1$
 	
+	// Needs additional local test plug-ins
+	private static final boolean TEST_DYNAMIC_AND_ACTIVATION= false;
+	
 	public static Test suite() {
 		return new TestSuite(PropertyTesterTests.class);
 	}
@@ -109,8 +116,9 @@
 	}
 	
 	public void testDynamicPlugin() throws Exception {
-		if (true)
+		if (!TEST_DYNAMIC_AND_ACTIVATION)
 			return;
+		
 		A receiver= new A();
 		Property p= fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing"); //$NON-NLS-1$ //$NON-NLS-2$
 		assertTrue(!p.isInstantiated());
@@ -123,6 +131,29 @@
 		assertTrue(!p.isInstantiated());
 	}
 	
+	public void testPluginActivation() throws Exception {
+		if (!TEST_DYNAMIC_AND_ACTIVATION)
+			return;
+		
+		Bundle bundle= Platform.getBundle("org.eclipse.core.expressions.tests.forceActivation"); //$NON-NLS-1$
+		assertTrue(bundle.getState() == Bundle.RESOLVED);
+		
+		A receiver= new A();
+		TestExpression exp= new TestExpression("org.eclipse.core.expressions.tests.forceActivation", "testing", null, null, true);
+		EvaluationContext context= new EvaluationContext(null, receiver);
+		EvaluationResult result= exp.evaluate(context);
+		assertTrue(result == EvaluationResult.NOT_LOADED);
+		assertTrue(bundle.getState() == Bundle.RESOLVED);
+		Property p= TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false); //$NON-NLS-1$ //$NON-NLS-2$
+		assertTrue(!p.isInstantiated());
+		
+		context.setAllowPluginActivation(true);
+		exp.evaluate(context);
+		assertTrue(bundle.getState() == Bundle.ACTIVE);
+		p= TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false); //$NON-NLS-1$ //$NON-NLS-2$
+		assertTrue(p.isInstantiated());
+	}
+	
 	public void testDifferentNameSpace() throws Exception {
 		assertTrue(test("org.eclipse.core.internal.expressions.tests2", a, "differentNamespace", null, "A3"));		 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 	}