Removed trailing whitespace and organized the imports
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java
index a8a2a83..0fb18ce 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ElementHandler.java
@@ -12,91 +12,91 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.core.internal.expressions.CompositeExpression;
import org.eclipse.core.internal.expressions.ExpressionMessages;
import org.eclipse.core.internal.expressions.ExpressionPlugin;
import org.eclipse.core.internal.expressions.StandardElementHandler;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
/**
- * An element handler converts an {@link IConfigurationElement} into a
- * corresponding expression object.
+ * An element handler converts an {@link IConfigurationElement} into a
+ * corresponding expression object.
* <p>
* The class should be subclassed by clients wishing to provide an element
* handler for special expressions.
* </p>
- * @since 3.0
+ * @since 3.0
*/
public abstract class ElementHandler {
-
+
private static final ElementHandler INSTANCE= new StandardElementHandler();
-
+
/**
* The default element handler which can cope with all XML expression elements
* defined by the common expression language.
- *
+ *
* @return the default element handler
*/
public static ElementHandler getDefault() {
return INSTANCE;
}
-
+
/**
* Creates the corresponding expression for the given configuration element.
- *
+ *
* @param converter the expression converter used to initiate the
* conversion process
- *
+ *
* @param config the configuration element to convert
- *
+ *
* @return the corresponding expression
- *
+ *
* @throws CoreException if the conversion failed
*/
public abstract Expression create(ExpressionConverter converter, IConfigurationElement config) throws CoreException;
-
+
/**
* Creates the corresponding expression for the given DOM element. This is
* an optional operation that is only required if the handler supports conversion
* of DOM elements.
- *
+ *
* @param converter the expression converter used to initiate the
* conversion process
- *
+ *
* @param element the DOM element to convert
- *
+ *
* @return the corresponding expression
- *
+ *
* @throws CoreException if the conversion failed
- *
+ *
* @since 3.3
*/
public Expression create(ExpressionConverter converter, Element element) throws CoreException {
throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
+ IStatus.ERROR,
ExpressionMessages.ElementHandler_unsupported_element,
null));
}
/**
- * Converts the children of the given configuration element and adds them
+ * Converts the children of the given configuration element and adds them
* to the given composite expression.
* <p>
* Note this is an internal method and should not be called by clients.
- * </p>
+ * </p>
* @param converter the converter used to do the actual conversion
- * @param element the configuration element for which the children
+ * @param element the configuration element for which the children
* are to be processed
* @param expression the composite expression representing the result
* of the conversion
- *
+ *
* @throws CoreException if the conversion failed
- *
+ *
* @nooverride This method is not intended to be re-implemented or extended by clients.
* @noreference This method is not intended to be referenced by clients.
*/
@@ -109,16 +109,16 @@
* given composite expression.
* <p>
* Note this is an internal method and should not be called by clients.
- * </p>
+ * </p>
* @param converter the converter used to do the actual conversion
* @param element the DOM element for which the children are to be processed
* @param expression the composite expression representing the result
* of the conversion
- *
+ *
* @throws CoreException if the conversion failed
- *
+ *
* @since 3.3
- *
+ *
* @nooverride This method is not intended to be re-implemented or extended by clients.
* @noreference This method is not intended to be referenced by clients.
*/
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 08aa5fc..abd15a1 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
@@ -21,10 +21,10 @@
* <p>
* Clients may instantiate this default context. The class is
* not intended to be subclassed by clients.
- * </p>
- *
+ * </p>
+ *
* @since 3.0
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class EvaluationContext implements IEvaluationContext {
@@ -34,11 +34,11 @@
private Map/*<String, Object>*/ fVariables;
private IVariableResolver[] fVariableResolvers;
private Boolean fAllowPluginActivation;
-
+
/**
* Create a new evaluation context with the given parent and default
* variable.
- *
+ *
* @param parent the parent context. Can be <code>null</code>.
* @param defaultVariable the default variable
*/
@@ -47,16 +47,16 @@
fParent= parent;
fDefaultVariable= defaultVariable;
}
-
+
/**
* Create a new evaluation context with the given parent and default
* variable.
- *
+ *
* @param parent the parent context. Can be <code>null</code>.
* @param defaultVariable the default variable
* @param resolvers an array of <code>IVariableResolvers</code> to
* resolve additional variables.
- *
+ *
* @see #resolveVariable(String, Object[])
*/
public EvaluationContext(IEvaluationContext parent, Object defaultVariable, IVariableResolver[] resolvers) {
@@ -66,14 +66,14 @@
fDefaultVariable= defaultVariable;
fVariableResolvers= resolvers;
}
-
+
/**
* {@inheritDoc}
*/
public IEvaluationContext getParent() {
return fParent;
}
-
+
/**
* {@inheritDoc}
*/
@@ -82,21 +82,21 @@
return this;
return fParent.getRoot();
}
-
+
/**
* {@inheritDoc}
*/
public Object getDefaultVariable() {
return fDefaultVariable;
}
-
+
/**
* {@inheritDoc}
*/
public void setAllowPluginActivation(boolean value) {
fAllowPluginActivation= value ? Boolean.TRUE : Boolean.FALSE;
}
-
+
/**
* {@inheritDoc}
*/
@@ -108,7 +108,7 @@
}
return fAllowPluginActivation.booleanValue();
}
-
+
/**
* {@inheritDoc}
*/
@@ -119,7 +119,7 @@
fVariables= new HashMap();
fVariables.put(name, value);
}
-
+
/**
* {@inheritDoc}
*/
@@ -129,7 +129,7 @@
return null;
return fVariables.remove(name);
}
-
+
/**
* {@inheritDoc}
*/
@@ -145,7 +145,7 @@
return fParent.getVariable(name);
return null;
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java
index f561c9b..bf0801a 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EvaluationResult.java
@@ -14,7 +14,7 @@
/**
* An evaluation result represents the result of an expression
- * evaluation. There are exact three instances of evaluation
+ * evaluation. There are exact three instances of evaluation
* result. They are: <code>FALSE</code>, <code>TRUE</code> and
* <code>NOT_LOADED</code>. <code>NOT_LOADED</code> represents
* the fact that an expression couldn't be evaluated since a
@@ -123,22 +123,22 @@
* </tr>
* </tbody>
* </table>
- *
+ *
* <p>
* The class is not intended to be subclassed by clients.
* </p>
* @since 3.0
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class EvaluationResult {
-
+
private int fValue;
-
+
private static final int FALSE_VALUE= 0;
private static final int TRUE_VALUE= 1;
private static final int NOT_LOADED_VALUE= 2;
-
+
/** The evaluation result representing the value FALSE */
public static final EvaluationResult FALSE= new EvaluationResult(FALSE_VALUE);
/** The evaluation result representing the value TRUE */
@@ -171,73 +171,73 @@
private EvaluationResult(int value) {
fValue= value;
}
-
+
/**
* Returns an <code>EvaluationResult</code> whose value is <code>this && other)</code>.
- *
+ *
* @param other the right hand side of the and operation.
- *
+ *
* @return <code>this && other</code> as defined by the evaluation result
*/
public EvaluationResult and(EvaluationResult other) {
return AND[fValue][other.fValue];
}
-
+
/**
* Returns an <code>EvaluationResult</code> whose value is <code>this || other)</code>.
- *
+ *
* @param other the right hand side of the or operation.
- *
+ *
* @return <code>this || other</code> as defined by the evaluation result
*/
public EvaluationResult or(EvaluationResult other) {
return OR[fValue][other.fValue];
}
-
+
/**
* Returns the inverted value of this evaluation result
- *
+ *
* @return the inverted value of this evaluation result
*/
public EvaluationResult not() {
return NOT[fValue];
}
-
+
/**
* Returns an evaluation result instance representing the
* given boolean value. If the given boolean value is
* <code>true</code> then <code>ExpressionResult.TRUE</code>
* is returned. If the value is <code>false</code> then <code>
* ExpressionResult.FALSE</code> is returned.
- *
+ *
* @param b a boolean value
- *
+ *
* @return the expression result representing the boolean
* value
*/
public static EvaluationResult valueOf(boolean b) {
return b ? TRUE : FALSE;
}
-
+
/**
* Returns a evaluation result instance representing the
* given <code>Boolean</code> value. If the given <code>Boolean
* </code> value is <code>true</code> then <code>ExpressionResult.TRUE</code>
* is returned. If the value is <code>false</code> then <code>
* ExpressionResult.FALSE</code> is returned.
- *
+ *
* @param b a <code>Boolean</code> value
- *
+ *
* @return the expression result representing the <code>Boolean</code>
* value
*/
public static EvaluationResult valueOf(Boolean b) {
return b.booleanValue() ? TRUE : FALSE;
}
-
+
/**
* For debugging purpose only
- *
+ *
* @return a string representing this object. The result is not
* human readable
*/
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java
index 132e0d7..e945ef4 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/Expression.java
@@ -21,7 +21,7 @@
* <p>
* This class may be subclassed to provide specific expressions.
* </p>
- *
+ *
* @since 3.0
*/
public abstract class Expression {
@@ -31,12 +31,12 @@
* <code>equals(Object)</code> method of the <code>left</code> object.
* This method handles <code>null</code> for either the <code>left</code>
* or <code>right</code> object.
- *
+ *
* @param left the first object to compare; may be <code>null</code>.
* @param right the second object to compare; may be <code>null</code>.
* @return <code>true</code> if the two objects are equivalent;
* <code>false</code> otherwise.
- *
+ *
* @since 3.2
*/
protected static final boolean equals(final Object left, final Object right) {
@@ -48,15 +48,15 @@
* Tests whether two arrays of objects are equal to each other. The arrays
* must not be <code>null</code>, but their elements may be
* <code>null</code>.
- *
+ *
* @param leftArray the left array to compare; may be <code>null</code>, and
* may be empty and may contain <code>null</code> elements.
- * @param rightArray the right array to compare; may be <code>null</code>,
+ * @param rightArray the right array to compare; may be <code>null</code>,
* and may be empty and may contain <code>null</code> elements.
- *
- * @return <code>true</code> if the arrays are equal length and the elements
+ *
+ * @return <code>true</code> if the arrays are equal length and the elements
* at the same position are equal; <code>false</code> otherwise.
- *
+ *
* @since 3.2
*/
protected static final boolean equals(final Object[] leftArray, final Object[] rightArray) {
@@ -89,13 +89,13 @@
/**
* Returns the hash code for the given <code>object</code>. This method
* handles <code>null</code>.
- *
+ *
* @param object the object for which the hash code is desired; may be
* <code>null</code>.
- *
+ *
* @return The hash code of the object; zero if the object is
* <code>null</code>.
- *
+ *
* @since 3.2
*/
protected static final int hashCode(final Object object) {
@@ -105,12 +105,12 @@
/**
* Returns the hash code for the given array. This method handles
* <code>null</code>.
- *
+ *
* @param array the array for which the hash code is desired; may be
* <code>null</code>.
* @return the hash code of the array; zero if the object is
* <code>null</code>.
- *
+ *
* @since 3.2
*/
protected static final int hashCode(final Object[] array) {
@@ -123,7 +123,7 @@
}
return hashCode;
}
-
+
/**
* The constant integer hash code value meaning the hash code has not yet
* been computed.
@@ -134,10 +134,10 @@
* A factor for computing the hash code for all expressions.
*/
protected static final int HASH_FACTOR = 89;
-
+
/**
* Name of the value attribute of an expression (value is <code>value</code>).
- */
+ */
protected static final String ATT_VALUE= "value"; //$NON-NLS-1$
/**
@@ -146,11 +146,11 @@
public static final Expression TRUE= new Expression() {
public EvaluationResult evaluate(IEvaluationContext context) {
return EvaluationResult.TRUE;
- }
+ }
public void collectExpressionInfo(ExpressionInfo info) {
}
};
-
+
/**
* The expression corresponding to {@link EvaluationResult#FALSE}.
*/
@@ -167,29 +167,29 @@
* not yet computed, it is equal to {@link #HASH_CODE_NOT_COMPUTED}.
*/
private transient int fHashCode= HASH_CODE_NOT_COMPUTED;
-
+
/**
- * Evaluates this expression.
- *
+ * Evaluates this expression.
+ *
* @param context an evaluation context providing information like variable,
* name spaces, etc. necessary to evaluate this expression
- *
+ *
* @return the result of the expression evaluation
- *
- * @throws CoreException if the evaluation failed. The concrete reason is
+ *
+ * @throws CoreException if the evaluation failed. The concrete reason is
* defined by the subclass implementing this method
*/
public abstract EvaluationResult evaluate(IEvaluationContext context) throws CoreException;
-
+
/**
* Computes the expression information for the given expression tree.
* <p>
* This is a convenience method for collecting the expression information
* using {@link Expression#collectExpressionInfo(ExpressionInfo)}.
* </p>
- *
+ *
* @return the expression information
- *
+ *
* @since 3.2
*/
public final ExpressionInfo computeExpressionInfo() {
@@ -197,21 +197,21 @@
collectExpressionInfo(result);
return result;
}
-
+
/**
* Collects information about this expression tree. This default
* implementation add the expression's type to the set of misbehaving
* expression types.
- *
+ *
* @param info the expression information object used
* to collect the information
- *
+ *
* @since 3.2
*/
public void collectExpressionInfo(ExpressionInfo info) {
info.addMisBehavingExpressionType(getClass());
}
-
+
/**
* Method to compute the hash code for this object. The result
* returned from this method in cached in the <code>fHashCode</code>
@@ -221,13 +221,13 @@
* This default implementation calls <code>super.hashCode()</code>
* </p>
* @return a hash code for this object.
- *
+ *
* @since 3.2
*/
protected int computeHashCode() {
return super.hashCode();
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java
index b0a4d63..f2c62b7 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionConverter.java
@@ -13,6 +13,11 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.eclipse.core.internal.expressions.CompositeExpression;
+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.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -20,41 +25,36 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.internal.expressions.CompositeExpression;
-import org.eclipse.core.internal.expressions.ExpressionMessages;
-import org.eclipse.core.internal.expressions.ExpressionPlugin;
-import org.eclipse.core.internal.expressions.Messages;
-
/**
- * An expression converter converts an XML expression represented by an
+ * An expression converter converts an XML expression represented by an
* {@link IConfigurationElement} or {@link Element} (DOM) subtree into a
* corresponding expression tree.
- *
+ *
* <p>
* An expression converter manages a list of {@link ElementHandler}s. Element
* handlers are responsible to do the actual conversion. The element handlers
* build a chain of responsibility.
* </p>
- *
- * @since 3.0
+ *
+ * @since 3.0
*/
public final class ExpressionConverter {
-
+
private ElementHandler[] fHandlers;
- private static final ExpressionConverter INSTANCE= new ExpressionConverter(
- new ElementHandler[] { ElementHandler.getDefault() } );
-
- /**
+ private static final ExpressionConverter INSTANCE= new ExpressionConverter(
+ new ElementHandler[] { ElementHandler.getDefault() } );
+
+ /**
* Returns the default expression converter. The default expression converter
* can cope with all expression elements defined by the common expression
* language.
- *
+ *
* @return the default expression converter
*/
public static ExpressionConverter getDefault() {
return INSTANCE;
}
-
+
/**
* Creates a new expression converter with the given list of element
* handlers. The element handlers build a chain of responsibility
@@ -62,23 +62,23 @@
* convert the configuration element. If this handler isn't able
* to convert the configuration element the next handler in the
* array is used.
- *
+ *
* @param handlers the array of element handlers
*/
public ExpressionConverter(ElementHandler[] handlers) {
Assert.isNotNull(handlers);
fHandlers= handlers;
}
-
+
/**
* Converts the tree of configuration elements represented by the given
* root element and returns a corresponding expression tree.
- *
+ *
* @param root the configuration element to be converted
- *
+ *
* @return the corresponding expression tree or <code>null</code>
* if the configuration element cannot be converted
- *
+ *
* @throws CoreException if the configuration element can't be
* converted. Reasons include: (a) no handler is available to
* cope with a certain configuration element or (b) the XML
@@ -97,16 +97,16 @@
/**
* Converts the tree of DOM elements represented by the given
* root element and returns a corresponding expression tree.
- *
+ *
* @param root the element to be converted
- *
+ *
* @return the corresponding expression tree or <code>null</code>
* if the element cannot be converted
- *
+ *
* @throws CoreException if the element can't be converted.
* Reasons include: (a) no handler is available to cope with
* a certain element or (b) the XML expression tree is malformed.
- *
+ *
* @since 3.3
*/
public Expression perform(Element root) throws CoreException {
@@ -126,14 +126,14 @@
Expression child= perform(children[i]);
if (child == null)
throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
+ IStatus.ERROR,
Messages.format(
- ExpressionMessages.Expression_unknown_element,
+ ExpressionMessages.Expression_unknown_element,
getDebugPath(children[i])),
null));
result.add(child);
}
- }
+ }
}
private String getDebugPath(IConfigurationElement configurationElement) {
@@ -170,9 +170,9 @@
Expression exp= perform((Element)child);
if (exp == null)
throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
+ IStatus.ERROR,
Messages.format(
- ExpressionMessages.Expression_unknown_element,
+ ExpressionMessages.Expression_unknown_element,
child.getNodeName()),
null));
result.add(exp);
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java
index 8fb1971..5201761 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionInfo.java
@@ -15,39 +15,39 @@
import java.util.List;
/**
- * A status object describing information about an expression tree.
+ * A status object describing information about an expression tree.
* This information can for example be used to decide whether an
* expression tree has to be reevaluated if the value of some
* variables changes.
* <p>
* This class is not intended to be extended by clients.
* </p>
- *
+ *
* @since 3.2
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class ExpressionInfo {
private boolean fHasDefaultVariableAccess;
private boolean fHasSystemPropertyAccess;
-
+
// Although we are using this as sets we use lists since
// they are faster for smaller numbers of elements
private List fAccessedVariableNames;
private List fMisbehavingExpressionTypes;
private List fAccessedPropertyNames;
-
+
/**
* Returns <code>true</code> if the default variable is accessed
* by the expression tree.
- *
+ *
* @return whether the default variable is accessed or not
*/
public boolean hasDefaultVariableAccess() {
return fHasDefaultVariableAccess;
}
-
+
/**
* Marks the default variable as accessed.
*/
@@ -58,13 +58,13 @@
/**
* Returns <code>true</code> if the system property is accessed
* by the expression tree.
- *
+ *
* @return whether the system property is accessed or not
*/
public boolean hasSystemPropertyAccess() {
return fHasSystemPropertyAccess;
}
-
+
/**
* Marks the system property as accessed.
*/
@@ -74,7 +74,7 @@
/**
* Returns the set of accessed variables.
- *
+ *
* @return the set of accessed variables
*/
public String[] getAccessedVariableNames() {
@@ -82,10 +82,10 @@
return new String[0];
return (String[])fAccessedVariableNames.toArray(new String[fAccessedVariableNames.size()]);
}
-
+
/**
* Marks the given variable as accessed.
- *
+ *
* @param name the accessed variable
*/
public void addVariableNameAccess(String name) {
@@ -97,12 +97,12 @@
fAccessedVariableNames.add(name);
}
}
-
+
/**
* Returns the set of accessed {@link PropertyTester} properties.
- *
+ *
* @return the fully qualified names of accessed properties, or an empty array
- *
+ *
* @see #hasSystemPropertyAccess() for system properties
* @since 3.4
*/
@@ -115,10 +115,10 @@
/**
* Marks the given property (the fully qualified name of a
* {@link PropertyTester} property) as accessed.
- *
+ *
* @param name
* the fully qualified property name
- *
+ *
* @see #markSystemPropertyAccessed() for system properties
* @since 3.4
*/
@@ -136,9 +136,9 @@
* Returns the set of expression types which don't implement the
* new (@link Expression#computeReevaluationInfo(IEvaluationContext)}
* method. If one expression didn't implement the method the expression
- * tree no optimizations can be done. Returns <code>null</code> if
+ * tree no optimizations can be done. Returns <code>null</code> if
* all expressions implement the method.
- *
+ *
* @return the set of expression types which don't implement the
* <code>computeReevaluationInfo</code> method.
*/
@@ -147,10 +147,10 @@
return null;
return (Class[])fMisbehavingExpressionTypes.toArray(new Class[fMisbehavingExpressionTypes.size()]);
}
-
+
/**
* Adds the given class to the list of misbehaving classes.
- *
+ *
* @param clazz the class to add.
*/
public void addMisBehavingExpressionType(Class clazz) {
@@ -162,16 +162,16 @@
fMisbehavingExpressionTypes.add(clazz);
}
}
-
+
/**
* Merges this reevaluation information with the given info.
- *
+ *
* @param other the information to merge with
*/
public void merge(ExpressionInfo other) {
mergeDefaultVariableAccess(other);
mergeSystemPropertyAccess(other);
-
+
mergeAccessedVariableNames(other);
mergeAccessedPropertyNames(other);
mergeMisbehavingExpressionTypes(other);
@@ -180,29 +180,29 @@
/**
* Merges this reevaluation information with the given info
* ignoring the default variable access.
- *
+ *
* @param other the information to merge with
*/
public void mergeExceptDefaultVariable(ExpressionInfo other) {
mergeSystemPropertyAccess(other);
-
+
mergeAccessedVariableNames(other);
mergeAccessedPropertyNames(other);
mergeMisbehavingExpressionTypes(other);
}
-
+
/**
* Merges only the default variable access.
- *
+ *
* @param other the information to merge with
*/
private void mergeDefaultVariableAccess(ExpressionInfo other) {
fHasDefaultVariableAccess= fHasDefaultVariableAccess || other.fHasDefaultVariableAccess;
}
-
+
/**
* Merges only the system property access.
- *
+ *
* @param other the information to merge with
*/
private void mergeSystemPropertyAccess(ExpressionInfo other) {
@@ -211,7 +211,7 @@
/**
* Merges only the accessed variable names.
- *
+ *
* @param other the information to merge with
*/
private void mergeAccessedVariableNames(ExpressionInfo other) {
@@ -230,7 +230,7 @@
/**
* Merges only the accessed property names.
- *
+ *
* @param other the information to merge with
* @see #mergeSystemPropertyAccess(ExpressionInfo) for system properties
* @since 3.4
@@ -248,10 +248,10 @@
}
}
}
-
+
/**
* Merges only the misbehaving expression types.
- *
+ *
* @param other the information to merge with
*/
private void mergeMisbehavingExpressionTypes(ExpressionInfo other) {
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java
index a2f97a5..114520c 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ExpressionTagNames.java
@@ -13,53 +13,53 @@
/**
* Class defining the tag names of the XML elements of the common
* expression language.
- *
+ *
* @since 3.0
*/
public final class ExpressionTagNames {
/** The tag name of the enablement expression (value: <code>enablement</code>) */
public static final String ENABLEMENT= "enablement"; //$NON-NLS-1$
-
+
/** The tag name of the and expression (value: <code>and</code>) */
public static final String AND= "and"; //$NON-NLS-1$
-
+
/** The tag name of the or expression (value: <code>or</code>) */
public static final String OR= "or"; //$NON-NLS-1$
-
+
/** The tag name of the not expression (value: <code>not</code>) */
public static final String NOT= "not"; //$NON-NLS-1$
-
+
/** The tag name of the instanceof expression (value: <code>instanceof</code>) */
public static final String INSTANCEOF= "instanceof"; //$NON-NLS-1$
-
+
/** The tag name of the test expression (value: <code>test</code>) */
public static final String TEST= "test"; //$NON-NLS-1$
-
+
/** The tag name of the with expression (value: <code>with</code>) */
public static final String WITH= "with"; //$NON-NLS-1$
-
+
/** The tag name of the adapt expression (value: <code>adapt</code>) */
public static final String ADAPT= "adapt"; //$NON-NLS-1$
-
+
/** The tag name of the count expression (value: <code>count</code>) */
public static final String COUNT= "count"; //$NON-NLS-1$
-
+
/** The tag name of the adapt expression (value: <code>iterate</code>) */
public static final String ITERATE= "iterate"; //$NON-NLS-1$
-
+
/** The tag name of the resolve expression (value: <code>resolve</code>) */
public static final String RESOLVE= "resolve"; //$NON-NLS-1$
/** The tag name of the systemTest expression (value: <code>systemTest</code>) */
public static final String SYSTEM_TEST= "systemTest"; //$NON-NLS-1$
-
+
/** The tag name of the equals expression (value: <code>equals</code>) */
public static final String EQUALS= "equals"; //$NON-NLS-1$
/**
* The tag name of the reference expression (value: <code>reference</code>)
- *
+ *
* @since 3.3
*/
public static final String REFERENCE= "reference"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java
index cfcd519..56926b9 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ICountable.java
@@ -16,18 +16,18 @@
/**
* Objects that are adaptable to <code>ICountable</code> can be used
* as the default variable in a count expression.
- *
+ *
* @see IAdaptable
* @see IAdapterManager
- *
+ *
* @since 3.3
*/
public interface ICountable {
/**
* Returns the number of elements.
- *
- * @return the number of elements
+ *
+ * @return the number of elements
*/
public int count();
}
\ 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 2d5c938..b964ee6 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
@@ -15,44 +15,44 @@
/**
* An evaluation context is used to manage a set of objects needed during
* XML expression evaluation. A context has a parent context, can manage
- * a set of named variables and has a default variable. The default variable
- * is used during XML expression evaluation if no explicit variable is
+ * a set of named variables and has a default variable. The default variable
+ * is used during XML expression evaluation if no explicit variable is
* referenced.
* <p>
* This interface is not intended to be implemented by clients. Clients
- * are allowed to instantiate <code>EvaluationContext</code>.
+ * are allowed to instantiate <code>EvaluationContext</code>.
* </p>
- *
+ *
* @since 3.0
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IEvaluationContext {
-
+
/**
- * Represents the value used by variables that exist but are not defined
+ * Represents the value used by variables that exist but are not defined
* in a evaluation context. When tested by the 'with' expression, <code>false</code>
* will be returned.
- *
+ *
* @since 3.4
*/
public static Object UNDEFINED_VARIABLE = new Object();
/**
- * Returns the parent context or <code>null</code> if
+ * Returns the parent context or <code>null</code> if
* this is the root of the evaluation context hierarchy.
- *
+ *
* @return the parent evaluation context or <code>null</code>
*/
public IEvaluationContext getParent();
-
+
/**
* Returns the root evaluation context.
- *
+ *
* @return the root evaluation context
*/
public IEvaluationContext getRoot();
-
+
/**
* Specifies whether this evaluation context allows activation
* of plug-ins for testers used in the expression tree. To actual
@@ -60,66 +60,66 @@
* 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
* @since 3.2
*/
public void setAllowPluginActivation(boolean value);
-
+
/**
- * Returns whether this evaluation context supports plug-in
+ * Returns whether this evaluation context supports plug-in
* activation. If not set via {@link #setAllowPluginActivation(boolean)}
* the parent value is returned. If no parent is set <code>false</code>
* is returned.
- *
+ *
* @return whether plug-in activation is supported or not
* @since 3.2
*/
public boolean getAllowPluginActivation();
-
+
/**
* Returns the default variable.
- *
+ *
* @return the default variable or <code>null</code> if
* no default variable is managed.
*/
public Object getDefaultVariable();
-
+
/**
* Adds a new named variable to this context. If a variable
* with the name already exists the new one overrides the
* existing one.
- *
+ *
* @param name the variable's name
* @param value the variable's value
*/
public void addVariable(String name, Object value);
-
+
/**
* Removes the variable managed under the given name
* from this evaluation context.
- *
+ *
* @param name the variable's name
* @return the currently stored value or <code>null</code> if
* the variable doesn't exist
*/
public Object removeVariable(String name);
-
+
/**
* Returns the variable managed under the given name.
- *
+ *
* @param name the variable's name
* @return the variable's value or <code>null</code> if the content
- * doesn't manage a variable with the given name
+ * doesn't manage a variable with the given name
*/
public Object getVariable(String name);
-
+
/**
* Resolves a variable for the given name and arguments. This
* method can be used to dynamically resolve variable such as
* plug-in descriptors, resources, etc. The method is used
* by the <code>resolve</code> expression.
- *
+ *
* @param name the variable to resolve
* @param args an object array of arguments used to resolve the
* variable
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java
index 0a75649..6b0fafd 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IIterable.java
@@ -18,17 +18,17 @@
/**
* Objects that are adaptable to <code>IIterable</code> can be used
* as the default variable in an iterate expression.
- *
+ *
* @see IAdaptable
* @see IAdapterManager
- *
+ *
* @since 3.3
*/
public interface IIterable {
/**
* Returns an iterator to iterate over the elements.
- *
+ *
* @return an iterator
*/
public Iterator iterator();
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java
index 2f2a701..ee02cc0 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IPropertyTester.java
@@ -13,15 +13,15 @@
import org.eclipse.core.runtime.CoreException;
/**
- * A property tester can be used to add additional properties to test to an
+ * A property tester can be used to add additional properties to test to an
* existing type.
* <p>
* This interface is not intended to be implemented by clients. Clients
* should subclass type <code>PropertyTester</code>.
* </p>
- *
+ *
* @since 3.0
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IPropertyTester {
@@ -29,55 +29,55 @@
/**
* Returns whether the property tester can handle the given
* property or not.
- *
+ *
* @param namespace the name space to be considered
* @param property the property to test
* @return <code>true</code> if the tester provides an implementation
* for the given property; otherwise <code>false</code> is returned
*/
public boolean handles(String namespace, String property);
-
+
/**
* Returns whether the implementation class for this property tester is
* loaded or not.
- *
- * @return <code>true</code>if the implementation class is loaded;
+ *
+ * @return <code>true</code>if the implementation class is loaded;
* <code>false</code> otherwise
*/
public boolean isInstantiated();
-
+
/**
* Returns <code>true</code> 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 <code>false</code> otherwise.
- *
+ *
* @return whether the implementation class can be loaded or not
*/
public boolean isDeclaringPluginActive();
-
+
/**
* Loads the implementation class for this property tester and returns an
* instance of this class.
- *
+ *
* @return an instance of the implementation class for this property tester
- *
+ *
* @throws CoreException if the implementation class cannot be loaded
*/
public IPropertyTester instantiate() throws CoreException;
-
+
/**
- * Executes the property test determined by the parameter <code>property</code>.
- *
+ * Executes the property test determined by the parameter <code>property</code>.
+ *
* @param receiver the receiver of the property test
* @param property the property to test
* @param args additional arguments to evaluate the property. If no arguments
* are specified in the <code>test</code> expression an array of length 0
* is passed
- * @param expectedValue the expected value of the property. The value is either
+ * @param expectedValue the expected value of the property. The value is either
* of type <code>java.lang.String</code> or a boxed base type. If no value was
* specified in the <code>test</code> expressions then <code>null</code> is passed
- *
- * @return returns <code>true<code> if the property is equal to the expected value;
+ *
+ * @return returns <code>true<code> if the property is equal to the expected value;
* otherwise <code>false</code> is returned
*/
public boolean test(Object receiver, String property, Object[] args, Object expectedValue);
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java
index 990a232..6fa4203 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/IVariableResolver.java
@@ -15,9 +15,9 @@
/**
* A variable resolver can be used to add additional variable resolving
* strategies to an {@link EvaluationContext}.
- *
+ *
* @see org.eclipse.core.expressions.EvaluationContext#resolveVariable(String, Object[])
- *
+ *
* @since 3.0
*/
public interface IVariableResolver {
@@ -26,7 +26,7 @@
* Resolves a variable for the given name and arguments. The
* handler is allowed to return <code>null</code> to indicate
* that it is not able to resolve the requested variable.
- *
+ *
* @param name the variable to resolve
* @param args an object array of arguments used to resolve the
* variable
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 d5f367d..7cd7aeb 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
@@ -12,11 +12,11 @@
import org.osgi.framework.Bundle;
+import org.eclipse.core.internal.expressions.PropertyTesterDescriptor;
+
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.internal.expressions.PropertyTesterDescriptor;
-
/**
* Abstract superclass of all property testers. Implementation classes of
* the extension point <code>org.eclipse.core.expresssions.propertyTesters
@@ -38,7 +38,7 @@
* public class MyPackageFragmentTester {
* public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
* IPackageFragment fragement= (IPackageFragment)receiver;
- * if ("isDefaultPackage".equals(property)) {
+ * if ("isDefaultPackage".equals(property)) {
* return expectedValue == null
* ? fragement.isDefaultPackage()
* : fragement.isDefaultPackage() == ((Boolean)expectedValue).booleanValue();
@@ -56,67 +56,67 @@
* </p>
* <p>
* There is no guarantee that the same instance of a property tester is used
- * to handle <test property="..."/> requests. So property testers
+ * to handle <test property="..."/> requests. So property testers
* should always be implemented in a stateless fashion.
* </p>
- * @since 3.0
+ * @since 3.0
*/
public abstract class PropertyTester implements IPropertyTester {
-
+
private IConfigurationElement fConfigElement;
private String fNamespace;
private String fProperties;
-
+
/**
* Initialize the property tester with the given name space and property.
* <p>
- * Note: this method is for internal use only. Clients must not call
+ * Note: this method is for internal use only. Clients must not call
* this method.
* </p>
* @param descriptor the descriptor object for this tester
- *
+ *
* @noreference This method is not intended to be referenced by clients.
*/
- public final void internalInitialize(PropertyTesterDescriptor descriptor) {
+ public final void internalInitialize(PropertyTesterDescriptor descriptor) {
fProperties= descriptor.getProperties();
fNamespace= descriptor.getNamespace();
fConfigElement= descriptor.getConfigurationElement();
}
-
+
/**
- * Note: this method is for internal use only. Clients must not call
+ * Note: this method is for internal use only. Clients must not call
* this method.
- *
+ *
* @return the property tester descriptor
- *
+ *
* @noreference This method is not intended to be referenced by clients.
*/
public final PropertyTesterDescriptor internalCreateDescriptor() {
return new PropertyTesterDescriptor(fConfigElement, fNamespace, fProperties);
}
-
+
/**
* {@inheritDoc}
*/
public final boolean handles(String namespace, String property) {
return fNamespace.equals(namespace) && fProperties.indexOf("," + property + ",") != -1; //$NON-NLS-1$//$NON-NLS-2$
}
-
+
/**
* {@inheritDoc}
*/
public final boolean isInstantiated() {
return true;
}
-
+
/**
* {@inheritDoc}
*/
public boolean isDeclaringPluginActive() {
Bundle bundle= Platform.getBundle(fConfigElement.getContributor().getName());
- return bundle.getState() == Bundle.ACTIVE;
+ return bundle.getState() == Bundle.ACTIVE;
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java
index 91a5df5..a1c0582 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AdaptExpression.java
@@ -12,16 +12,16 @@
import org.w3c.dom.Element;
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.ExpressionInfo;
+import org.eclipse.core.expressions.IEvaluationContext;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.ExpressionInfo;
-import org.eclipse.core.expressions.IEvaluationContext;
-
public class AdaptExpression extends CompositeExpression {
private static final String ATT_TYPE= "type"; //$NON-NLS-1$
@@ -30,9 +30,9 @@
* The seed for the hash code for all adapt expressions.
*/
private static final int HASH_INITIAL= AdaptExpression.class.getName().hashCode();
-
+
private String fTypeName;
-
+
public AdaptExpression(IConfigurationElement configElement) throws CoreException {
fTypeName= configElement.getAttribute(ATT_TYPE);
Expressions.checkAttribute(ATT_TYPE, fTypeName);
@@ -51,7 +51,7 @@
public boolean equals(final Object object) {
if (!(object instanceof AdaptExpression))
return false;
-
+
final AdaptExpression that= (AdaptExpression)object;
return this.fTypeName.equals(that.fTypeName)
&& equals(this.fExpressions, that.fExpressions);
@@ -61,7 +61,7 @@
return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
* HASH_FACTOR + fTypeName.hashCode();
}
-
+
/* (non-Javadoc)
* @see Expression#evaluate(IVariablePool)
*/
@@ -76,7 +76,7 @@
} else {
if (!manager.hasAdapter(var, fTypeName))
return EvaluationResult.FALSE;
-
+
adapted= manager.getAdapter(var, fTypeName);
}
// the adapted result is null but hasAdapter returned true check
@@ -90,12 +90,12 @@
}
return evaluateAnd(new DefaultVariable(context, adapted));
}
-
+
public void collectExpressionInfo(ExpressionInfo info) {
// Although the default variable is passed to the children of this
// expression as an instance of the adapted type it is OK to only
// mark a default variable access.
info.markDefaultVariableAccessed();
super.collectExpressionInfo(info);
- }
+ }
}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java
index a6cc0be..64fe28f 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/AndExpression.java
@@ -10,22 +10,22 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions;
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+
public class AndExpression extends CompositeExpression {
public boolean equals(final Object object) {
if (!(object instanceof AndExpression))
return false;
-
+
final AndExpression that= (AndExpression)object;
return equals(this.fExpressions, that.fExpressions);
- }
+ }
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
return evaluateAnd(context);
- }
+ }
}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java
index 7eaa2a4..4bae071 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CompositeExpression.java
@@ -14,13 +14,13 @@
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+
public abstract class CompositeExpression extends Expression {
private static final Expression[] EMPTY_ARRAY = new Expression[0];
@@ -29,21 +29,21 @@
* The seed for the hash code for all composite expressions.
*/
private static final int HASH_INITIAL= CompositeExpression.class.getName().hashCode();
-
+
protected List fExpressions;
-
+
public void add(Expression expression) {
if (fExpressions == null)
fExpressions= new ArrayList(2);
fExpressions.add(expression);
}
-
+
public Expression[] getChildren() {
if (fExpressions == null)
return EMPTY_ARRAY;
return (Expression[])fExpressions.toArray(new Expression[fExpressions.size()]);
}
-
+
protected EvaluationResult evaluateAnd(IEvaluationContext scope) throws CoreException {
if (fExpressions == null)
return EvaluationResult.TRUE;
@@ -58,7 +58,7 @@
}
return result;
}
-
+
protected EvaluationResult evaluateOr(IEvaluationContext scope) throws CoreException {
if (fExpressions == null)
return EvaluationResult.TRUE;
@@ -71,7 +71,7 @@
}
return result;
}
-
+
public void collectExpressionInfo(ExpressionInfo info) {
if (fExpressions == null)
return;
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java
index eb63d3c..7541c54 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/CountExpression.java
@@ -14,15 +14,15 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.ICountable;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class CountExpression extends Expression {
@@ -37,10 +37,10 @@
* The seed for the hash code for all count expressions.
*/
private static final int HASH_INITIAL= CountExpression.class.getName().hashCode();
-
+
private int fMode;
private int fSize;
-
+
public CountExpression(IConfigurationElement configElement) {
String size = configElement.getAttribute(ATT_VALUE);
initializeSize(size);
@@ -54,7 +54,7 @@
public CountExpression(String size) {
initializeSize(size);
}
-
+
private void initializeSize(String size) {
if (size == null)
size= "*"; //$NON-NLS-1$
@@ -111,7 +111,7 @@
public boolean equals(final Object object) {
if (!(object instanceof CountExpression))
return false;
-
+
final CountExpression that= (CountExpression)object;
return (this.fMode == that.fMode) && (this.fSize == that.fSize);
}
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 2dc280f..5513c0c 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
@@ -10,15 +10,15 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions;
+import org.eclipse.core.expressions.IEvaluationContext;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.expressions.IEvaluationContext;
-
/**
* An evaluation context that can be used to add a new default variable
* to a hierarchy of evaluation contexts.
- *
+ *
* @since 3.0
*/
public final class DefaultVariable implements IEvaluationContext {
@@ -26,11 +26,11 @@
private Object fDefaultVariable;
private IEvaluationContext fParent;
private IEvaluationContext fManagedPool;
-
+
/**
* Constructs a new variable pool for a single default variable.
- *
- * @param parent the parent context for the default variable. Must not
+ *
+ * @param parent the parent context for the default variable. Must not
* be <code>null</code>.
* @param defaultVariable the default variable
*/
@@ -65,14 +65,14 @@
public Object getDefaultVariable() {
return fDefaultVariable;
}
-
+
/**
* {@inheritDoc}
*/
public void setAllowPluginActivation(boolean value) {
fParent.setAllowPluginActivation(value);
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java
index 2d8a8c1..7392375 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/DefinitionRegistry.java
@@ -13,6 +13,9 @@
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.ExpressionConverter;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionDelta;
@@ -22,12 +25,9 @@
import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-
/**
* This manages the extension point that allows core expression reuse.
- *
+ *
* @since 3.3
*/
public class DefinitionRegistry implements IRegistryChangeListener {
@@ -48,7 +48,7 @@
* Get the expression with the id defined by an extension. This class will
* cache the expressions when appropriate, so it's OK to always ask the
* registry.
- *
+ *
* @param id The unique ID of the expression definition
* @return the expression
* @throws CoreException If the expression cannot be found.
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
index aa2844b..47a6a1f 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EnablementExpression.java
@@ -12,17 +12,17 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class EnablementExpression extends CompositeExpression {
/**
* Creates a {@link EnablementExpression}.
- *
+ *
* @param configElement the configuration element
*/
public EnablementExpression(IConfigurationElement configElement) {
@@ -31,7 +31,7 @@
/**
* Creates a {@link EnablementExpression}.
- *
+ *
* @param element the XML element
*/
public EnablementExpression(Element element) {
@@ -41,11 +41,11 @@
public boolean equals(final Object object) {
if (!(object instanceof EnablementExpression))
return false;
-
+
final EnablementExpression that= (EnablementExpression)object;
return equals(this.fExpressions, that.fExpressions);
- }
-
+ }
+
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
long start= 0;
if (Expressions.TRACING)
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java
index 04abcad..3198cef 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/EqualsExpression.java
@@ -12,28 +12,28 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class EqualsExpression extends Expression {
/**
* The seed for the hash code for all equals expressions.
*/
private static final int HASH_INITIAL= EqualsExpression.class.getName().hashCode();
- private Object fExpectedValue;
-
+ private Object fExpectedValue;
+
public EqualsExpression(Object expectedValue) {
Assert.isNotNull(expectedValue);
fExpectedValue= expectedValue;
}
-
+
public EqualsExpression(IConfigurationElement element) throws CoreException {
String value= element.getAttribute(ATT_VALUE);
Expressions.checkAttribute(ATT_VALUE, value);
@@ -58,7 +58,7 @@
public boolean equals(final Object object) {
if (!(object instanceof EqualsExpression))
return false;
-
+
final EqualsExpression that= (EqualsExpression)object;
return this.fExpectedValue.equals(that.fExpectedValue);
}
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 f5bdd2d..1f4bd5d 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
@@ -24,24 +24,24 @@
public static String Expression_attribute_invalid_value;
public static String Expression_variable_not_a_collection;
public static String Expression_variable_not_a_list;
-
+
public static String Expression_variable_not_iterable;
public static String Expression_variable_not_countable;
-
+
public static String Expression_unknown_element;
public static String Missing_Expression;
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;
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java
index c4cee1c..f5e66c6 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionPlugin.java
@@ -15,23 +15,23 @@
import org.eclipse.core.runtime.Plugin;
public class ExpressionPlugin extends Plugin {
-
+
private static ExpressionPlugin fgDefault;
-
+
private BundleContext fBundleContext;
-
+
public ExpressionPlugin() {
fgDefault= this;
- }
+ }
public static ExpressionPlugin getDefault() {
return fgDefault;
}
-
+
public static String getPluginId() {
return "org.eclipse.core.expressions"; //$NON-NLS-1$
}
-
+
/**
* {@inheritDoc}
*/
@@ -39,14 +39,14 @@
super.start(context);
fBundleContext= context;
}
-
+
/**
* {@inheritDoc}
*/
public void stop(BundleContext context) throws Exception {
super.stop(context);
}
-
+
public BundleContext getBundleContext() {
return fBundleContext;
}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java
index 47ab18e..b01737b 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ExpressionStatus.java
@@ -15,81 +15,81 @@
/**
* Represents the outcome of an expression evaluation. Status objects are
- * used inside {@link org.eclipse.core.runtime.CoreException} objects to
+ * used inside {@link org.eclipse.core.runtime.CoreException} objects to
* indicate what went wrong.
- *
+ *
* @see org.eclipse.core.runtime.CoreException
- *
+ *
* @since 3.0
*/
public class ExpressionStatus extends Status {
-
+
/** Error code indicating that the variable in focus in not a collection */
public static final int VARIABLE_IS_NOT_A_COLLECTION= 3;
-
+
/** Error code indicating that the variable in focus in not a list */
public static final int VARIABLE_IS_NOT_A_LIST= 4;
-
+
/** Error code indicating that an attribute value doesn't present an integer */
public static final int VALUE_IS_NOT_AN_INTEGER= 5;
-
+
/** Error code indicating that a mandatory attribute is missing */
public static final int MISSING_ATTRIBUTE= 50;
-
+
/** Error code indicating that the value specified for an attribute is invalid */
public static final int WRONG_ATTRIBUTE_VALUE= 51;
/** Error code indicating that we are unable to find an expression */
public static final int MISSING_EXPRESSION = 52;
-
+
/** Error code indicating that the number of arguments passed to resolve variable is incorrect. */
public static final int VARAIBLE_POOL_WRONG_NUMBER_OF_ARGUMENTS= 100;
-
+
/** Error code indicating that the argument passed to resolve a variable is not of type java.lang.String */
public static final int VARAIBLE_POOL_ARGUMENT_IS_NOT_A_STRING= 101;
-
- /** Error code indicating that a plugin providing a certain type extender isn't loaded yet */
+
+ /** Error code indicating that a plugin providing a certain type extender isn't loaded yet */
public static final int TYPE_EXTENDER_PLUGIN_NOT_LOADED= 200;
-
+
/** Error indicating that a property referenced in a test expression can't be resolved */
public static final int TYPE_EXTENDER_UNKOWN_METHOD= 201;
-
+
/** Error code indicating that the implementation class of a type extender is not of type TypeExtender */
public static final int TYPE_EXTENDER_INCORRECT_TYPE= 202;
-
+
/** Error indicating that the value returned from a type extender isn't of type boolean */
public static final int TEST_EXPRESSION_NOT_A_BOOLEAN= 203;
-
+
/** Error indicating that the property attribute of the test element doesn't have a name space */
public static final int NO_NAMESPACE_PROVIDED= 300;
-
+
/** Error indicating that a variable accessed in a with expression isn't available in the evaluation context */
public static final int VARIABLE_NOT_DEFINED= 301;
-
+
/** Error indicating that in a string passed via a arg attribute the apostrophe character isn't correctly escaped */
public static final int STRING_NOT_CORRECT_ESCAPED= 302;
-
+
/** Error indicating that a string passed via a arg attribute isn't correctly terminated with an apostrophe */
public static final int STRING_NOT_TERMINATED= 303;
-
+
/**
* Creates a new expression status.
- *
+ *
* @param errorCode the error code of the status
* @param message a human-readable message, localized to the current locale
*/
public ExpressionStatus(int errorCode, String message) {
this(errorCode, message, null);
}
-
+
/**
* Creates a new expression status.
- *
+ *
* @param errorCode the error code of the status
* @param message a human-readable message, localized to the current locale
- * @param exception a low-level exception, or <code>null</code> if not applicable
+ * @param exception a low-level exception, or <code>null</code> if not applicable
*/
public ExpressionStatus(int errorCode, String message, Throwable exception) {
super(IStatus.ERROR, ExpressionPlugin.getPluginId(), errorCode, message, exception);
- }
+ }
}
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 50981d6..3c88235 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
@@ -18,40 +18,40 @@
import org.w3c.dom.Element;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.ICountable;
+import org.eclipse.core.expressions.IIterable;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ICountable;
-import org.eclipse.core.expressions.IIterable;
-
public class Expressions {
/**
* Cache to optimize instanceof computation. Map of String->Map(String, Boolean).
*/
private static final Map knownClasses = new HashMap();
-
+
/* debugging flag to enable tracing */
public static final boolean TRACING;
static {
String value= Platform.getDebugOption("org.eclipse.core.expressions/tracePropertyResolving"); //$NON-NLS-1$
TRACING= value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
}
-
+
private Expressions() {
// no instance
}
-
+
public static boolean isInstanceOf(Object element, String type) {
// null isn't an instanceof of anything.
if (element == null)
return false;
- return isSubtype(element.getClass(), type);
+ return isSubtype(element.getClass(), type);
}
-
+
private static synchronized boolean isSubtype(Class clazz, String type) {
String clazzName = clazz.getName();
Map nameMap = (Map) knownClasses.get(clazzName);
@@ -79,18 +79,18 @@
for (int i= 0; i < interfaces.length; i++) {
if (uncachedIsSubtype(interfaces[i], type))
return true;
- }
+ }
return false;
}
-
+
public static void checkAttribute(String name, String value) throws CoreException {
if (value == null) {
throw new CoreException(new ExpressionStatus(
- ExpressionStatus.MISSING_ATTRIBUTE,
- Messages.format(ExpressionMessages.Expression_attribute_missing, name)));
+ ExpressionStatus.MISSING_ATTRIBUTE,
+ Messages.format(ExpressionMessages.Expression_attribute_missing, name)));
}
}
-
+
public static void checkAttribute(String name, String value, String[] validValues) throws CoreException {
checkAttribute(name, value);
for (int i= 0; i < validValues.length; i++) {
@@ -98,35 +98,35 @@
return;
}
throw new CoreException(new ExpressionStatus(
- ExpressionStatus.WRONG_ATTRIBUTE_VALUE,
- Messages.format(ExpressionMessages.Expression_attribute_invalid_value, value)));
+ ExpressionStatus.WRONG_ATTRIBUTE_VALUE,
+ Messages.format(ExpressionMessages.Expression_attribute_invalid_value, value)));
}
-
+
public static void checkCollection(Object var, Expression expression) throws CoreException {
if (var instanceof Collection)
return;
throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
- Messages.format(ExpressionMessages.Expression_variable_not_a_collection, expression.toString())));
+ ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
+ Messages.format(ExpressionMessages.Expression_variable_not_a_collection, expression.toString())));
}
-
+
public static void checkList(Object var, Expression expression) throws CoreException {
if (var instanceof List)
return;
throw new CoreException(new ExpressionStatus(
- ExpressionStatus.VARIABLE_IS_NOT_A_LIST,
- Messages.format(ExpressionMessages.Expression_variable_not_a_list, expression.toString())));
+ ExpressionStatus.VARIABLE_IS_NOT_A_LIST,
+ Messages.format(ExpressionMessages.Expression_variable_not_a_list, expression.toString())));
}
-
+
/**
* Converts the given variable into an <code>IIterable</code>. If a corresponding adapter can't be found an
* exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned.
- *
- * @param var the variable to turn into an <code>IIterable</code>
+ *
+ * @param var the variable to turn into an <code>IIterable</code>
* @param expression the expression referring to the variable
- *
+ *
* @return the <code>IIterable</code> or <code>null<code> if a corresponding adapter isn't loaded yet
- *
+ *
* @throws CoreException if the var can't be adapted to an <code>IIterable</code>
*/
public static IIterable getAsIIterable(Object var, Expression expression) throws CoreException {
@@ -137,25 +137,25 @@
IIterable result= (IIterable)manager.getAdapter(var, IIterable.class);
if (result != null)
return result;
-
+
if (manager.queryAdapter(var, IIterable.class.getName()) == IAdapterManager.NOT_LOADED)
return null;
-
+
throw new CoreException(new ExpressionStatus(
ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
- Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString())));
+ Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString())));
}
}
-
+
/**
* Converts the given variable into an <code>ICountable</code>. If a corresponding adapter can't be found an
* exception is thrown. If the corresponding adapter isn't loaded yet, <code>null</code> is returned.
- *
- * @param var the variable to turn into an <code>ICountable</code>
+ *
+ * @param var the variable to turn into an <code>ICountable</code>
* @param expression the expression referring to the variable
- *
+ *
* @return the <code>ICountable</code> or <code>null<code> if a corresponding adapter isn't loaded yet
- *
+ *
* @throws CoreException if the var can't be adapted to an <code>ICountable</code>
*/
public static ICountable getAsICountable(Object var, Expression expression) throws CoreException {
@@ -166,16 +166,16 @@
ICountable result= (ICountable)manager.getAdapter(var, ICountable.class);
if (result != null)
return result;
-
+
if (manager.queryAdapter(var, ICountable.class.getName()) == IAdapterManager.NOT_LOADED)
return null;
-
+
throw new CoreException(new ExpressionStatus(
ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
- Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString())));
+ Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString())));
}
}
-
+
public static boolean getOptionalBooleanAttribute(IConfigurationElement element, String attributeName) {
String value= element.getAttribute(attributeName);
if (value == null)
@@ -191,9 +191,9 @@
}
//---- Argument parsing --------------------------------------------
-
+
public static final Object[] EMPTY_ARGS= new Object[0];
-
+
public static Object[] getArguments(IConfigurationElement element, String attributeName) throws CoreException {
String args= element.getAttribute(attributeName);
if (args != null) {
@@ -223,12 +223,12 @@
result.add(convertArgument(args.substring(start).trim()));
return result.toArray();
}
-
+
private static int findNextComma(String str, int start) throws CoreException {
boolean inString= false;
for (int i= start; i < str.length(); i++) {
char ch= str.charAt(i);
- if (ch == ',' && ! inString)
+ if (ch == ',' && ! inString)
return i;
if (ch == '\'') {
if (!inString) {
@@ -246,12 +246,12 @@
}
if (inString)
throw new CoreException(new ExpressionStatus(
- ExpressionStatus.STRING_NOT_TERMINATED,
- Messages.format(ExpressionMessages.Expression_string_not_terminated, str)));
-
+ ExpressionStatus.STRING_NOT_TERMINATED,
+ Messages.format(ExpressionMessages.Expression_string_not_terminated, str)));
+
return -1;
}
-
+
public static Object convertArgument(String arg) throws CoreException {
if (arg == null) {
return null;
@@ -285,8 +285,8 @@
if (ch == '\'') {
if (i == str.length() - 1 || str.charAt(i + 1) != '\'')
throw new CoreException(new ExpressionStatus(
- ExpressionStatus.STRING_NOT_CORRECT_ESCAPED,
- Messages.format(ExpressionMessages.Expression_string_not_correctly_escaped, str)));
+ ExpressionStatus.STRING_NOT_CORRECT_ESCAPED,
+ Messages.format(ExpressionMessages.Expression_string_not_correctly_escaped, str)));
result.append('\'');
i++;
} else {
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java
index 54ddc1c..05bf357 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/InstanceofExpression.java
@@ -12,15 +12,15 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class InstanceofExpression extends Expression {
/**
* The seed for the hash code for all instance of expressions.
@@ -28,7 +28,7 @@
private static final int HASH_INITIAL= InstanceofExpression.class.getName().hashCode();
private String fTypeName;
-
+
public InstanceofExpression(IConfigurationElement element) throws CoreException {
fTypeName= element.getAttribute(ATT_VALUE);
Expressions.checkAttribute(ATT_VALUE, fTypeName);
@@ -43,7 +43,7 @@
Assert.isNotNull(typeName);
fTypeName= typeName;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.corext.refactoring.participants.Expression#evaluate(java.lang.Object)
*/
@@ -51,7 +51,7 @@
Object element= context.getDefaultVariable();
return EvaluationResult.valueOf(Expressions.isInstanceOf(element, fTypeName));
}
-
+
public void collectExpressionInfo(ExpressionInfo info) {
info.markDefaultVariableAccessed();
}
@@ -59,7 +59,7 @@
public boolean equals(final Object object) {
if (!(object instanceof InstanceofExpression))
return false;
-
+
final InstanceofExpression that= (InstanceofExpression) object;
return this.fTypeName.equals(that.fTypeName);
}
@@ -67,9 +67,9 @@
protected int computeHashCode() {
return HASH_INITIAL * HASH_FACTOR + fTypeName.hashCode();
}
-
+
//---- Debugging ---------------------------------------------------
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
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 1d516e7..9065dd4 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
@@ -16,23 +16,23 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.expressions.IIterable;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class IterateExpression extends CompositeExpression {
-
+
private static class IteratePool implements IEvaluationContext {
-
+
private Iterator fIterator;
private Object fDefaultVariable;
private IEvaluationContext fParent;
-
+
public IteratePool(IEvaluationContext parent, Iterator iterator) {
Assert.isNotNull(parent);
Assert.isNotNull(iterator);
@@ -74,7 +74,7 @@
return fIterator.hasNext();
}
}
-
+
private static final String ATT_OPERATOR= "operator"; //$NON-NLS-1$
private static final String ATT_IF_EMPTY= "ifEmpty"; //$NON-NLS-1$
private static final int OR= 1;
@@ -84,10 +84,10 @@
* The seed for the hash code for all iterate expressions.
*/
private static final int HASH_INITIAL= IterateExpression.class.getName().hashCode();
-
+
private int fOperator;
private Boolean fEmptyResult;
-
+
public IterateExpression(IConfigurationElement configElement) throws CoreException {
String opValue= configElement.getAttribute(ATT_OPERATOR);
initializeOperatorValue(opValue);
@@ -104,12 +104,12 @@
public IterateExpression(String opValue) throws CoreException {
initializeOperatorValue(opValue);
}
-
+
public IterateExpression(String opValue, String ifEmpty) throws CoreException {
initializeOperatorValue(opValue);
initializeEmptyResultValue(ifEmpty);
}
-
+
private void initializeOperatorValue(String opValue) throws CoreException {
if (opValue == null) {
fOperator= AND;
@@ -122,7 +122,7 @@
}
}
}
-
+
private void initializeEmptyResultValue(String value) {
if (value == null) {
fEmptyResult= null;
@@ -137,7 +137,7 @@
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
Object var= context.getDefaultVariable();
if (var instanceof Collection) {
- Collection col= (Collection)var;
+ Collection col= (Collection)var;
switch (col.size()) {
case 0:
if (fEmptyResult == null) {
@@ -215,10 +215,10 @@
public boolean equals(final Object object) {
if (!(object instanceof IterateExpression))
return false;
-
+
final IterateExpression that= (IterateExpression)object;
return (this.fOperator == that.fOperator) && equals(this.fExpressions, that.fExpressions);
- }
+ }
protected int computeHashCode() {
return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java
index 813a2f7..67cae0f 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/Messages.java
@@ -15,7 +15,7 @@
/**
* Helper class to format message strings.
- *
+ *
* @since 3.1
*/
public class Messages {
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java
index 53d0aec..c24ed42 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/NotExpression.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+
public class NotExpression extends Expression {
/**
* The seed for the hash code for all not expressions.
@@ -30,11 +30,11 @@
Assert.isNotNull(expression);
fExpression= expression;
}
-
+
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
return fExpression.evaluate(context).not();
}
-
+
public void collectExpressionInfo(ExpressionInfo info) {
fExpression.collectExpressionInfo(info);
}
@@ -42,7 +42,7 @@
public boolean equals(final Object object) {
if (!(object instanceof NotExpression))
return false;
-
+
final NotExpression that= (NotExpression)object;
return this.fExpression.equals(that.fExpression);
}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java
index b19e28b..e380356 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/OrExpression.java
@@ -10,22 +10,22 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions;
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.IEvaluationContext;
-public class OrExpression extends CompositeExpression {
+import org.eclipse.core.runtime.CoreException;
+
+public class OrExpression extends CompositeExpression {
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
return evaluateOr(context);
}
-
+
public boolean equals(final Object object) {
if (!(object instanceof OrExpression))
return false;
-
+
final OrExpression that= (OrExpression)object;
return equals(this.fExpressions, that.fExpressions);
- }
+ }
}
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 4624303..c2dcc05 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
@@ -10,41 +10,41 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.core.expressions.IPropertyTester;
+import org.eclipse.core.runtime.Assert;
+
public class Property {
-
+
private Class fType;
private String fNamespace;
private String fName;
-
+
private IPropertyTester fTester;
/* package */ Property(Class type, String namespace, String name) {
Assert.isNotNull(type);
Assert.isNotNull(namespace);
Assert.isNotNull(name);
-
+
fType= type;
fNamespace= namespace;
fName= name;
}
-
+
/* package */ void setPropertyTester(IPropertyTester tester) {
Assert.isNotNull(tester);
fTester= tester;
}
-
+
public boolean isInstantiated() {
return fTester.isInstantiated();
}
-
+
public boolean isDeclaringPluginActive() {
return fTester.isDeclaringPluginActive();
}
-
+
public boolean isValidCacheEntry(boolean forcePluginActivation) {
if (forcePluginActivation) {
return isInstantiated() && isDeclaringPluginActive();
@@ -53,18 +53,18 @@
(!isInstantiated() && !isDeclaringPluginActive());
}
}
-
+
public boolean test(Object receiver, Object[] args, Object expectedValue) {
return fTester.test(receiver, fName, args, expectedValue);
}
-
+
public boolean equals(Object obj) {
if (!(obj instanceof Property))
return false;
Property other= (Property)obj;
return fType.equals(other.fType) && fNamespace.equals(other.fNamespace) && fName.equals(other.fName);
}
-
+
public int hashCode() {
return (fType.hashCode() << 16) | fNamespace.hashCode() << 8 | fName.hashCode();
}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java
index 4840827..640f86a 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyCache.java
@@ -13,22 +13,22 @@
import org.eclipse.core.internal.expressions.util.LRUCache;
/* package */ class PropertyCache {
-
+
private LRUCache fCache;
-
+
public PropertyCache(final int cacheSize) {
fCache= new LRUCache(100);
fCache.setSpaceLimit(cacheSize);
}
-
+
public Property get(Property key) {
return (Property)fCache.get(key);
}
-
+
public void put(Property method) {
fCache.put(method, method);
}
-
+
public void remove(Property method) {
fCache.removeKey(method);
}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java
index 10adaa5..e615cfa 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/PropertyTesterDescriptor.java
@@ -12,6 +12,8 @@
import org.osgi.framework.Bundle;
+import org.eclipse.core.expressions.IPropertyTester;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -19,33 +21,31 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.expressions.IPropertyTester;
-
public class PropertyTesterDescriptor implements IPropertyTester {
-
+
private IConfigurationElement fConfigElement;
private String fNamespace;
private String fProperties;
-
+
private static final String PROPERTIES= "properties"; //$NON-NLS-1$
private static final String NAMESPACE= "namespace"; //$NON-NLS-1$
private static final String CLASS= "class"; //$NON-NLS-1$
-
+
public PropertyTesterDescriptor(IConfigurationElement element) throws CoreException {
fConfigElement= element;
fNamespace= fConfigElement.getAttribute(NAMESPACE);
if (fNamespace == null) {
throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
- ExpressionMessages.PropertyTesterDescriptor_no_namespace,
+ IStatus.ERROR,
+ ExpressionMessages.PropertyTesterDescriptor_no_namespace,
null));
}
StringBuffer buffer= new StringBuffer(","); //$NON-NLS-1$
String properties= element.getAttribute(PROPERTIES);
if (properties == null) {
throw new CoreException(new Status(IStatus.ERROR, ExpressionPlugin.getPluginId(),
- IStatus.ERROR,
- ExpressionMessages.PropertyTesterDescritpri_no_properties,
+ IStatus.ERROR,
+ ExpressionMessages.PropertyTesterDescritpri_no_properties,
null));
}
for (int i= 0; i < properties.length(); i++) {
@@ -56,42 +56,42 @@
buffer.append(',');
fProperties= buffer.toString();
}
-
+
public PropertyTesterDescriptor(IConfigurationElement element, String namespace, String properties) {
fConfigElement= element;
fNamespace= namespace;
fProperties= properties;
}
-
+
public String getProperties() {
return fProperties;
}
-
+
public String getNamespace() {
return fNamespace;
}
-
+
public IConfigurationElement getConfigurationElement() {
return fConfigElement;
}
-
+
public boolean handles(String namespace, String property) {
return fNamespace.equals(namespace) && fProperties.indexOf("," + property + ",") != -1; //$NON-NLS-1$//$NON-NLS-2$
}
-
+
public boolean isInstantiated() {
return false;
}
-
+
public boolean isDeclaringPluginActive() {
Bundle fBundle= Platform.getBundle(fConfigElement.getContributor().getName());
- return fBundle.getState() == Bundle.ACTIVE;
+ return fBundle.getState() == Bundle.ACTIVE;
}
-
+
public IPropertyTester instantiate() throws CoreException {
return (IPropertyTester)fConfigElement.createExecutableExtension(CLASS);
}
-
+
public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
Assert.isTrue(false, "Method should never be called"); //$NON-NLS-1$
return false;
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java
index 68cc402..9ff9009 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ReferenceExpression.java
@@ -12,20 +12,20 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
/**
* This class makes use of the <b>org.eclipse.core.expressions.definitions</b>
* extension point to evaluate the current context against pre-defined
* expressions. It provides core expression re-use.
- *
+ *
* @since 3.3
*/
public class ReferenceExpression extends Expression {
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
index da1a5f8..446096f 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/ResolveExpression.java
@@ -12,20 +12,20 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class ResolveExpression extends CompositeExpression {
private String fVariable;
private Object[] fArgs;
-
+
private static final String ATT_VARIABLE= "variable"; //$NON-NLS-1$
private static final String ATT_ARGS= "args"; //$NON-NLS-1$
@@ -33,7 +33,7 @@
* The seed for the hash code for all resolve expressions.
*/
private static final int HASH_INITIAL= ResolveExpression.class.getName().hashCode();
-
+
public ResolveExpression(IConfigurationElement configElement) throws CoreException {
fVariable= configElement.getAttribute(ATT_VARIABLE);
Expressions.checkAttribute(ATT_VARIABLE, fVariable);
@@ -57,11 +57,11 @@
if (variable == null) {
throw new CoreException(new ExpressionStatus(
ExpressionStatus.VARIABLE_NOT_DEFINED,
- Messages.format(ExpressionMessages.ResolveExpression_variable_not_defined, fVariable)));
+ Messages.format(ExpressionMessages.ResolveExpression_variable_not_defined, fVariable)));
}
return evaluateAnd(new EvaluationContext(context, variable));
}
-
+
public void collectExpressionInfo(ExpressionInfo info) {
ExpressionInfo other= new ExpressionInfo();
super.collectExpressionInfo(other);
@@ -74,10 +74,10 @@
public boolean equals(final Object object) {
if (!(object instanceof ResolveExpression))
return false;
-
+
final ResolveExpression that= (ResolveExpression)object;
- return this.fVariable.equals(that.fVariable)
- && equals(this.fArgs, that.fArgs)
+ return this.fVariable.equals(that.fVariable)
+ && equals(this.fArgs, that.fArgs)
&& equals(this.fExpressions, that.fExpressions);
}
@@ -85,5 +85,5 @@
return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
* HASH_FACTOR + hashCode(fArgs)
* HASH_FACTOR + fVariable.hashCode();
- }
+ }
}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java
index 2f7d5be..1941150 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/StandardElementHandler.java
@@ -13,16 +13,16 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.ElementHandler;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.expressions.ExpressionTagNames;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class StandardElementHandler extends ElementHandler {
-
+
public Expression create(ExpressionConverter converter, IConfigurationElement element) throws CoreException {
String name= element.getName();
if (ExpressionTagNames.INSTANCEOF.equals(name)) {
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java
index 2b649ea..1a25f8d 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/SystemTestExpression.java
@@ -12,27 +12,27 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class SystemTestExpression extends Expression {
private String fProperty;
private String fExpectedValue;
-
+
private static final String ATT_PROPERTY= "property"; //$NON-NLS-1$
-
+
/**
* The seed for the hash code for all system test expressions.
*/
private static final int HASH_INITIAL= SystemTestExpression.class.getName().hashCode();
-
+
public SystemTestExpression(IConfigurationElement element) throws CoreException {
fProperty= element.getAttribute(ATT_PROPERTY);
Expressions.checkAttribute(ATT_PROPERTY, fProperty);
@@ -53,10 +53,10 @@
fProperty= property;
fExpectedValue= expectedValue;
}
-
+
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
String str= System.getProperty(fProperty);
- if (str == null)
+ if (str == null)
return EvaluationResult.FALSE;
return EvaluationResult.valueOf(str.equals(fExpectedValue));
}
@@ -68,7 +68,7 @@
public boolean equals(final Object object) {
if (!(object instanceof SystemTestExpression))
return false;
-
+
final SystemTestExpression that= (SystemTestExpression)object;
return this.fProperty.equals(that.fProperty)
&& this.fExpectedValue.equals(that.fExpectedValue);
@@ -78,9 +78,9 @@
return HASH_INITIAL * HASH_FACTOR + fExpectedValue.hashCode()
* HASH_FACTOR + fProperty.hashCode();
}
-
+
// ---- Debugging ---------------------------------------------------
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
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 fa870b0..c4e1bc8 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
@@ -12,15 +12,15 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class TestExpression extends Expression {
private String fNamespace;
@@ -28,7 +28,7 @@
private Object[] fArgs;
private Object fExpectedValue;
private boolean fForcePluginActivation;
-
+
private static final char PROP_SEP = '.';
private static final String ATT_PROPERTY= "property"; //$NON-NLS-1$
private static final String ATT_ARGS= "args"; //$NON-NLS-1$
@@ -37,16 +37,16 @@
* The seed for the hash code for all test expressions.
*/
private static final int HASH_INITIAL= TestExpression.class.getName().hashCode();
-
+
private static final TypeExtensionManager fgTypeExtensionManager= new TypeExtensionManager("propertyTesters"); //$NON-NLS-1$
-
+
public TestExpression(IConfigurationElement element) throws CoreException {
String property= element.getAttribute(ATT_PROPERTY);
int pos= property.lastIndexOf(PROP_SEP);
if (pos == -1) {
throw new CoreException(new ExpressionStatus(
ExpressionStatus.NO_NAMESPACE_PROVIDED,
- ExpressionMessages.TestExpression_no_name_space));
+ ExpressionMessages.TestExpression_no_name_space));
}
fNamespace= property.substring(0, pos);
fProperty= property.substring(pos + 1);
@@ -61,7 +61,7 @@
if (pos == -1) {
throw new CoreException(new ExpressionStatus(
ExpressionStatus.NO_NAMESPACE_PROVIDED,
- ExpressionMessages.TestExpression_no_name_space));
+ ExpressionMessages.TestExpression_no_name_space));
}
fNamespace= property.substring(0, pos);
fProperty= property.substring(pos + 1);
@@ -74,7 +74,7 @@
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);
@@ -89,7 +89,7 @@
Object element= context.getDefaultVariable();
if (System.class.equals(element)) {
String str= System.getProperty(fProperty);
- if (str == null)
+ if (str == null)
return EvaluationResult.FALSE;
return EvaluationResult.valueOf(str.equals(fArgs[0]));
}
@@ -107,9 +107,9 @@
public boolean equals(final Object object) {
if (!(object instanceof TestExpression))
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);
}
@@ -121,9 +121,9 @@
* HASH_FACTOR + fProperty.hashCode()
* HASH_FACTOR + (fForcePluginActivation ? 1 : 0);
}
-
+
//---- Debugging ---------------------------------------------------
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@@ -147,13 +147,13 @@
" 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;
}
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 c8433a1..0cc94cd 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
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.core.expressions.IPropertyTester;
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+
public class TypeExtension {
-
+
private static final TypeExtension[] EMPTY_TYPE_EXTENSION_ARRAY= new TypeExtension[0];
/* a special property tester instance that is used to signal that method searching has to continue */
@@ -38,39 +38,39 @@
return false;
}
};
-
+
/* 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, boolean forcePluginActivation) throws CoreException {
return CONTINUE;
}
};
-
+
/* the type this extension is extending */
private Class fType;
/* the list of associated extenders */
private IPropertyTester[] fExtenders;
-
+
/* the extension associated with <code>fType</code>'s super class */
private TypeExtension fExtends;
- /* the extensions associated with <code>fTypes</code>'s interfaces */
+ /* the extensions associated with <code>fTypes</code>'s interfaces */
private TypeExtension[] fImplements;
-
+
private TypeExtension() {
// special constructor to create the CONTINUE instance
}
-
+
/* package */ TypeExtension(Class type) {
Assert.isNotNull(type);
fType= type;
}
-
+
/* package */ IPropertyTester findTypeExtender(TypeExtensionManager manager, String namespace, String method, boolean staticMethod, boolean forcePluginActivation) throws CoreException {
if (fExtenders == null) {
fExtenders= manager.loadTesters(fType);
}
IPropertyTester result;
-
+
// handle extenders associated with this type extender
for (int i= 0; i < fExtenders.length; i++) {
IPropertyTester extender= fExtenders[i];
@@ -99,7 +99,7 @@
fExtenders[i]= null;
throw new CoreException(new ExpressionStatus(
ExpressionStatus.TYPE_EXTENDER_INCORRECT_TYPE,
- ExpressionMessages.TypeExtender_incorrectType,
+ ExpressionMessages.TypeExtender_incorrectType,
e));
}
} else {
@@ -107,11 +107,11 @@
}
}
}
-
+
// there is no inheritance for static methods
- if (staticMethod)
+ if (staticMethod)
return CONTINUE;
-
+
// handle extends chain
if (fExtends == null) {
Class superClass= fType.getSuperclass();
@@ -124,7 +124,7 @@
result= fExtends.findTypeExtender(manager, namespace, method, staticMethod, forcePluginActivation);
if (result != CONTINUE)
return result;
-
+
// handle implements chain
if (fImplements == null) {
Class[] interfaces= fType.getInterfaces();
@@ -134,7 +134,7 @@
fImplements= new TypeExtension[interfaces.length];
for (int i= 0; i < interfaces.length; i++) {
fImplements[i]= manager.get(interfaces[i]);
- }
+ }
}
}
for (int i= 0; i < fImplements.length; i++) {
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 01a4f77..ef94114 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
@@ -15,6 +15,8 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.expressions.IPropertyTester;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -24,16 +26,14 @@
import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.expressions.IPropertyTester;
-
public class TypeExtensionManager implements IRegistryChangeListener {
-
- private String fExtensionPoint;
-
+
+ private String fExtensionPoint;
+
private static final String TYPE= "type"; //$NON-NLS-1$
-
+
private static final IPropertyTester[] EMPTY_PROPERTY_TESTER_ARRAY= new IPropertyTester[0];
-
+
private static final IPropertyTester NULL_PROPERTY_TESTER= new IPropertyTester() {
public boolean handles(String namespace, String property) {
return false;
@@ -51,23 +51,23 @@
return false;
}
};
-
+
/*
- * Map containing all already created type extension object.
+ * Map containing all already created type extension object.
*/
private Map/*<Class, TypeExtension>*/ fTypeExtensionMap;
-
+
/*
- * Table containing mapping of class name to configuration element
+ * Table containing mapping of class name to configuration element
*/
private Map/*<String, List<IConfigurationElement>>*/ fConfigurationElementMap;
-
+
/*
* A cache to give fast access to the last 1000 method invocations.
*/
private PropertyCache fPropertyCache;
-
-
+
+
public TypeExtensionManager(String extensionPoint) {
Assert.isNotNull(extensionPoint);
fExtensionPoint= extensionPoint;
@@ -78,12 +78,12 @@
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();
-
+
// if we call a static method than the receiver is the class object
Class clazz= receiver instanceof Class ? (Class)receiver : receiver.getClass();
Property result= new Property(clazz, namespace, method);
@@ -109,7 +109,7 @@
throw new CoreException(new ExpressionStatus(
ExpressionStatus.TYPE_EXTENDER_UNKOWN_METHOD,
Messages.format(
- ExpressionMessages.TypeExtender_unknownMethod,
+ ExpressionMessages.TypeExtender_unknownMethod,
new String[] {namespace + '.' + method, clazz.toString()})));
}
result.setPropertyTester(extender);
@@ -122,7 +122,7 @@
}
return result;
}
-
+
/*
* This method doesn't need to be synchronized since it is called
* from withing the getProperty method which is synchronized
@@ -135,7 +135,7 @@
}
return result;
}
-
+
/*
* This method doesn't need to be synchronized since it is called
* from withing the getProperty method which is synchronized
@@ -145,8 +145,8 @@
fConfigurationElementMap= new HashMap();
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor(
- ExpressionPlugin.getPluginId(),
- fExtensionPoint);
+ ExpressionPlugin.getPluginId(),
+ fExtensionPoint);
for (int i= 0; i < ces.length; i++) {
IConfigurationElement config= ces[i];
String typeAttr= config.getAttribute(TYPE);
@@ -177,14 +177,14 @@
return result;
}
}
-
+
public void registryChanged(IRegistryChangeEvent event) {
IExtensionDelta[] deltas= event.getExtensionDeltas(ExpressionPlugin.getPluginId(), fExtensionPoint);
if (deltas.length > 0) {
initializeCaches();
}
}
-
+
private synchronized void initializeCaches() {
fTypeExtensionMap= new HashMap();
fConfigurationElementMap= null;
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java
index 996d055..d6632ee 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/WithExpression.java
@@ -12,15 +12,15 @@
import org.w3c.dom.Element;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.ExpressionInfo;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class WithExpression extends CompositeExpression {
private String fVariable;
@@ -30,7 +30,7 @@
* The seed for the hash code for all with expressions.
*/
private static final int HASH_INITIAL= WithExpression.class.getName().hashCode();
-
+
public WithExpression(IConfigurationElement configElement) throws CoreException {
fVariable= configElement.getAttribute(ATT_VARIABLE);
Expressions.checkAttribute(ATT_VARIABLE, fVariable);
@@ -49,11 +49,11 @@
public boolean equals(final Object object) {
if (!(object instanceof WithExpression))
return false;
-
+
final WithExpression that= (WithExpression)object;
return this.fVariable.equals(that.fVariable) && equals(this.fExpressions, that.fExpressions);
}
-
+
protected int computeHashCode() {
return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions)
* HASH_FACTOR + fVariable.hashCode();
@@ -64,7 +64,7 @@
if (variable == null) {
throw new CoreException(new ExpressionStatus(
ExpressionStatus.VARIABLE_NOT_DEFINED,
- Messages.format(ExpressionMessages.WithExpression_variable_not_defined, fVariable)));
+ Messages.format(ExpressionMessages.WithExpression_variable_not_defined, fVariable)));
}
if (variable == IEvaluationContext.UNDEFINED_VARIABLE) {
return EvaluationResult.FALSE;
@@ -79,5 +79,5 @@
info.addVariableNameAccess(fVariable);
}
info.mergeExceptDefaultVariable(other);
- }
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java
index 28313d0..f356787 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/propertytester/PlatformPropertyTester.java
@@ -12,11 +12,11 @@
import org.osgi.framework.Bundle;
+import org.eclipse.core.expressions.PropertyTester;
+
import org.eclipse.core.runtime.IProduct;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.expressions.PropertyTester;
-
/**
* A property tester for testing platform properties. Can test whether or
* not a given bundle is installed in the running environment, as well as
@@ -29,7 +29,7 @@
* <p>
*/
public class PlatformPropertyTester extends PropertyTester {
-
+
private static final String PROPERTY_PRODUCT = "product"; //$NON-NLS-1$
private static final String PROPERTY_IS_BUNDLE_INSTALLED = "isBundleInstalled"; //$NON-NLS-1$
private static final String PROPERTY_BUNDLE_STATE = "bundleState"; //$NON-NLS-1$
@@ -58,7 +58,7 @@
}
return false;
}
-
+
private boolean bundleState(int bundleState, Object expectedValue) {
if ("UNINSTALLED".equals(expectedValue)) { //$NON-NLS-1$
return bundleState == Bundle.UNINSTALLED;
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java
index f738078..e7508f7 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/LRUCache.java
@@ -15,12 +15,12 @@
/**
* Copied from JDT/Core to get a cache which is independent from
- * JDK 1.4.
+ * JDK 1.4.
*/
public class LRUCache implements Cloneable {
/**
- * This type is used internally by the LRUCache to represent entries
+ * This type is used internally by the LRUCache to represent entries
* stored in the cache.
* It is static because it does not require a pointer to the cache
* which contains it.
@@ -28,43 +28,43 @@
* @see LRUCache
*/
protected static class LRUCacheEntry {
-
+
/**
* Hash table key
*/
public Object _fKey;
-
+
/**
* Hash table value (an LRUCacheEntry object)
*/
- public Object _fValue;
+ public Object _fValue;
/**
* Time value for queue sorting
*/
public int _fTimestamp;
-
+
/**
* Cache footprint of this entry
*/
public int _fSpace;
-
+
/**
* Previous entry in queue
*/
public LRUCacheEntry _fPrevious;
-
+
/**
* Next entry in queue
*/
public LRUCacheEntry _fNext;
-
+
/**
* Creates a new instance of the receiver with the provided values
* for key, value, and space.
- * @param key
- * @param value
- * @param space
+ * @param key
+ * @param value
+ * @param space
*/
public LRUCacheEntry (Object key, Object value, int space) {
_fKey = key;
@@ -80,48 +80,48 @@
return "LRUCacheEntry [" + _fKey + "-->" + _fValue + "]"; //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-2$
}
- }
+ }
/**
* Amount of cache space used so far
*/
protected int fCurrentSpace;
-
+
/**
* Maximum space allowed in cache
*/
protected int fSpaceLimit;
-
+
/**
* Counter for handing out sequential timestamps
*/
protected int fTimestampCounter;
-
+
/**
* Hash table for fast random access to cache entries
*/
protected Hashtable fEntryTable;
/**
- * Start of queue (most recently used entry)
- */
+ * Start of queue (most recently used entry)
+ */
protected LRUCacheEntry fEntryQueue;
/**
* End of queue (least recently used entry)
- */
+ */
protected LRUCacheEntry fEntryQueueTail;
-
+
/**
* Default amount of space in the cache
*/
protected static final int DEFAULT_SPACELIMIT = 100;
/**
- * Creates a new cache. Size of cache is defined by
+ * Creates a new cache. Size of cache is defined by
* <code>DEFAULT_SPACELIMIT</code>.
*/
public LRUCache() {
-
+
this(DEFAULT_SPACELIMIT);
}
/**
@@ -129,7 +129,7 @@
* @param size Size of Cache
*/
public LRUCache(int size) {
-
+
fTimestampCounter = fCurrentSpace = 0;
fEntryQueue = fEntryQueueTail = null;
fEntryTable = new Hashtable(size);
@@ -141,10 +141,10 @@
* @return New copy of object.
*/
public Object clone() {
-
+
LRUCache newCache = newInstance(fSpaceLimit);
LRUCacheEntry qEntry;
-
+
/* Preserve order of entries by copying from oldest to newest */
qEntry = this.fEntryQueueTail;
while (qEntry != null) {
@@ -164,7 +164,7 @@
fCurrentSpace = 0;
LRUCacheEntry entry = fEntryQueueTail; // Remember last entry
fEntryTable = new Hashtable(); // Clear it out
- fEntryQueue = fEntryQueueTail = null;
+ fEntryQueue = fEntryQueueTail = null;
while (entry != null) { // send deletion notifications in LRU order
privateNotifyDeletionFromCache(entry);
entry = entry._fPrevious;
@@ -177,9 +177,9 @@
* @param key Key of object to flush
*/
public void flush (Object key) {
-
+
LRUCacheEntry entry;
-
+
entry = (LRUCacheEntry) fEntryTable.get(key);
/* If entry does not exist, return */
@@ -195,12 +195,12 @@
* @return Retreived object, or null if object does not exist
*/
public Object get(Object key) {
-
+
LRUCacheEntry entry = (LRUCacheEntry) fEntryTable.get(key);
if (entry == null) {
return null;
}
-
+
this.updateTimestamp (entry);
return entry._fValue;
}
@@ -234,21 +234,21 @@
* @return a boolean
*/
protected boolean makeSpace (int space) {
-
+
int limit;
-
+
limit = this.getSpaceLimit();
-
+
/* if space is already available */
if (fCurrentSpace + space <= limit) {
return true;
}
-
+
/* if entry is too big for cache */
if (space > limit) {
return false;
}
-
+
/* Free up space by removing oldest entries */
while (fCurrentSpace + space > limit && fEntryQueueTail != null) {
this.privateRemoveEntry (fEntryQueueTail, false);
@@ -272,7 +272,7 @@
* @return the object
*/
public Object peek(Object key) {
-
+
LRUCacheEntry entry = (LRUCacheEntry) fEntryTable.get(key);
if (entry == null) {
return null;
@@ -281,65 +281,65 @@
}
/**
* Adds an entry for the given key/value/space.
- * @param key
- * @param value
- * @param space
+ * @param key
+ * @param value
+ * @param space
*/
protected void privateAdd (Object key, Object value, int space) {
-
+
LRUCacheEntry entry;
-
+
entry = new LRUCacheEntry(key, value, space);
this.privateAddEntry (entry, false);
}
/**
* Adds the given entry from the receiver.
- * @param entry
- * @param shuffle Indicates whether we are just shuffling the queue
+ * @param entry
+ * @param shuffle Indicates whether we are just shuffling the queue
* (in which case, the entry table is not modified).
*/
protected void privateAddEntry (LRUCacheEntry entry, boolean shuffle) {
-
+
if (!shuffle) {
fEntryTable.put (entry._fKey, entry);
fCurrentSpace += entry._fSpace;
}
-
+
entry._fTimestamp = fTimestampCounter++;
entry._fNext = this.fEntryQueue;
entry._fPrevious = null;
-
+
if (fEntryQueue == null) {
/* this is the first and last entry */
fEntryQueueTail = entry;
} else {
fEntryQueue._fPrevious = entry;
}
-
+
fEntryQueue = entry;
}
/**
- * An entry has been removed from the cache, for example because it has
- * fallen off the bottom of the LRU queue.
+ * An entry has been removed from the cache, for example because it has
+ * fallen off the bottom of the LRU queue.
* Subclasses could over-ride this to implement a persistent cache below the LRU cache.
- * @param entry
+ * @param entry
*/
protected void privateNotifyDeletionFromCache(LRUCacheEntry entry) {
// Default is NOP.
}
/**
- * Removes the entry from the entry queue.
- * @param entry
- * @param shuffle indicates whether we are just shuffling the queue
+ * Removes the entry from the entry queue.
+ * @param entry
+ * @param shuffle indicates whether we are just shuffling the queue
* (in which case, the entry table is not modified).
*/
protected void privateRemoveEntry (LRUCacheEntry entry, boolean shuffle) {
-
+
LRUCacheEntry previous, next;
-
+
previous = entry._fPrevious;
next = entry._fNext;
-
+
if (!shuffle) {
fEntryTable.remove(entry._fKey);
fCurrentSpace -= entry._fSpace;
@@ -368,19 +368,19 @@
* @return added value.
*/
public Object put(Object key, Object value) {
-
+
int newSpace, oldSpace, newTotal;
LRUCacheEntry entry;
-
+
/* Check whether there's an entry in the cache */
newSpace = spaceFor(value);
entry = (LRUCacheEntry) fEntryTable.get (key);
-
+
if (entry != null) {
-
+
/**
* Replace the entry in the cache if it would not overflow
- * the cache. Otherwise flush the entry and re-add it so as
+ * the cache. Otherwise flush the entry and re-add it so as
* to keep cache within budget
*/
oldSpace = entry._fSpace;
@@ -408,7 +408,7 @@
* @return Value removed from cache.
*/
public Object removeKey (Object key) {
-
+
LRUCacheEntry entry = (LRUCacheEntry) fEntryTable.get(key);
if (entry == null) {
return null;
@@ -430,24 +430,24 @@
}
/**
* Returns the space taken by the given value.
- * @param value
+ * @param value
* @return an int
*/
protected int spaceFor (Object value) {
return 1;
}
-
+
/**
* Returns a String that represents the value of this object. This method
* is for debugging purposes only.
* @return a string
*/
public String toString() {
- return
+ return
toStringFillingRation("LRUCache") + //$NON-NLS-1$
toStringContents();
}
-
+
/**
* Returns a String that represents the contents of this object. This method
* is for debugging purposes only.
@@ -469,14 +469,14 @@
for (int i = 0; i < length; i++) {
String toString = sorter.sortedStrings[i];
Object value = this.get(sorter.sortedObjects[i]);
- result.append(toString);
+ result.append(toString);
result.append(" -> "); //$NON-NLS-1$
result.append(value);
result.append("\n"); //$NON-NLS-1$
}
return result.toString();
}
-
+
public String toStringFillingRation(String cacheName) {
StringBuffer buffer = new StringBuffer(cacheName);
buffer.append('[');
@@ -488,12 +488,12 @@
}
/**
- * Updates the timestamp for the given entry, ensuring that the queue is
+ * Updates the timestamp for the given entry, ensuring that the queue is
* kept in correct order. The entry must exist
- * @param entry
+ * @param entry
*/
protected void updateTimestamp (LRUCacheEntry entry) {
-
+
entry._fTimestamp = fTimestampCounter++;
if (fEntryQueue != entry) {
this.privateRemoveEntry (entry, true);
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java
index ccc011e..f10777c 100644
--- a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions/util/ToStringSorter.java
@@ -26,8 +26,8 @@
/**
* Returns true if stringTwo is 'greater than' stringOne This is the
* 'ordering' method of the sort operation.
- * @param stringOne
- * @param stringTwo
+ * @param stringOne
+ * @param stringTwo
* @return a boolean
*/
public boolean compare(String stringOne, String stringTwo) {
@@ -36,8 +36,8 @@
/**
* Sort the objects in sorted collection and return that collection.
- * @param left
- * @param right
+ * @param left
+ * @param right
*/
private void quickSort(int left, int right) {
int originalLeft= left;
@@ -71,8 +71,8 @@
/**
* Return a new sorted collection from this unsorted collection. Sort using
* quick sort.
- * @param unSortedObjects
- * @param unsortedStrings
+ * @param unSortedObjects
+ * @param unsortedStrings
*/
public void sort(Object[] unSortedObjects, String[] unsortedStrings) {
int size= unSortedObjects.length;
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java
index c923803..eb06802 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions.tests;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+
public class A_TypeExtender extends PropertyTester {
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java
index 17516b3..c85777d 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender2.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions.tests;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+
public class A_TypeExtender2 extends PropertyTester {
public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java
index 777bec4..54bddde 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/A_TypeExtender3.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions.tests;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+
public class A_TypeExtender3 extends PropertyTester {
public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
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 09c9d96..ab4222c 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
@@ -14,7 +14,7 @@
import junit.framework.TestSuite;
public class AllTests {
-
+
public static Test suite() {
TestSuite suite= new TestSuite("All Expression Language Tests"); //$NON-NLS-1$
suite.addTest(PropertyTesterTests.suite());
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java
index a1c064c..5b09909 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/B_TypeExtender.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions.tests;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+
public class B_TypeExtender extends PropertyTester {
public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java
index 87df052..ab590ce 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CollectionAdapterFactory.java
@@ -13,11 +13,11 @@
import java.util.Collection;
import java.util.Iterator;
-import org.eclipse.core.runtime.IAdapterFactory;
-
import org.eclipse.core.expressions.ICountable;
import org.eclipse.core.expressions.IIterable;
+import org.eclipse.core.runtime.IAdapterFactory;
+
public class CollectionAdapterFactory implements IAdapterFactory {
@@ -27,14 +27,14 @@
public Iterator iterator() {
return ((ExpressionTests.CollectionWrapper)adaptableObject).collection.iterator();
}
- };
+ };
}
if (adapterType.equals(ICountable.class) && adaptableObject instanceof ExpressionTests.CollectionWrapper) {
return new ICountable() {
public int count() {
return ((ExpressionTests.CollectionWrapper)adaptableObject).collection.size();
}
- };
+ };
}
return null;
}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
index fb7046c..8e2736e 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionInfoTests.java
@@ -19,7 +19,6 @@
import junit.framework.TestSuite;
import org.eclipse.core.expressions.ExpressionInfo;
-
import org.eclipse.core.internal.expressions.AdaptExpression;
import org.eclipse.core.internal.expressions.AndExpression;
import org.eclipse.core.internal.expressions.CountExpression;
@@ -40,28 +39,28 @@
}
// ---- test merging ------------------------------------------------------------------------
-
+
public void testMergeEmpty() {
ExpressionInfo info= new ExpressionInfo();
info.merge(new ExpressionInfo());
assertNoAccess(info);
}
-
+
public void testMergeDefaultVariable() {
ExpressionInfo info;
ExpressionInfo other;
-
+
info= new ExpressionInfo();
info.markDefaultVariableAccessed();
info.merge(new ExpressionInfo());
assertDefaultAccessOnly(info);
-
+
info= new ExpressionInfo();
other= new ExpressionInfo();
other.markDefaultVariableAccessed();
info.merge(other);
assertDefaultAccessOnly(info);
-
+
info= new ExpressionInfo();
other= new ExpressionInfo();
info.markDefaultVariableAccessed();
@@ -69,22 +68,22 @@
info.merge(other);
assertDefaultAccessOnly(info);
}
-
+
public void testMergeSystemProperty() {
ExpressionInfo info;
ExpressionInfo other;
-
+
info= new ExpressionInfo();
info.markSystemPropertyAccessed();
info.merge(new ExpressionInfo());
assertSystemPropertyOnly(info);
-
+
info= new ExpressionInfo();
other= new ExpressionInfo();
other.markSystemPropertyAccessed();
info.merge(other);
assertSystemPropertyOnly(info);
-
+
info= new ExpressionInfo();
other= new ExpressionInfo();
info.markSystemPropertyAccessed();
@@ -92,29 +91,29 @@
info.merge(other);
assertSystemPropertyOnly(info);
}
-
+
public void testMergeVariableNames() {
ExpressionInfo info;
ExpressionInfo other;
-
+
info= new ExpressionInfo();
info.addVariableNameAccess("variable");
info.merge(new ExpressionInfo());
assertVariableAccess(info, "variable");
-
+
info= new ExpressionInfo();
other= new ExpressionInfo();
other.addVariableNameAccess("variable");
info.merge(other);
assertVariableAccess(info, "variable");
-
+
info= new ExpressionInfo();
info.addVariableNameAccess("variable");
other= new ExpressionInfo();
other.addVariableNameAccess("variable");
info.merge(other);
assertVariableAccess(info, "variable");
-
+
info= new ExpressionInfo();
info.addVariableNameAccess("variable_one");
other= new ExpressionInfo();
@@ -122,7 +121,7 @@
info.merge(other);
assertVariableAccess(info, new String[] {"variable_one", "variable_two"});
}
-
+
public void testMergePropertyNames() {
ExpressionInfo info;
ExpressionInfo other;
@@ -152,29 +151,29 @@
info.merge(other);
assertPropertyAccess(info, new String[] { "prop1", "prop2" }, false);
}
-
+
public void testMergeMisbehavingExpressionTypes() {
ExpressionInfo info;
ExpressionInfo other;
-
+
info= new ExpressionInfo();
info.addMisBehavingExpressionType(WithExpression.class);
info.merge(new ExpressionInfo());
assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class});
-
+
info= new ExpressionInfo();
other= new ExpressionInfo();
other.addMisBehavingExpressionType(WithExpression.class);
info.merge(other);
assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class});
-
+
info= new ExpressionInfo();
info.addMisBehavingExpressionType(WithExpression.class);
other= new ExpressionInfo();
other.addMisBehavingExpressionType(WithExpression.class);
info.merge(other);
assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class});
-
+
info= new ExpressionInfo();
info.addMisBehavingExpressionType(WithExpression.class);
other= new ExpressionInfo();
@@ -182,9 +181,9 @@
info.merge(other);
assertMisbehavedExpressionTypes(info, new Class[] {WithExpression.class, ResolveExpression.class});
}
-
+
// ---- test expression ---------------------------------------------------------------------
-
+
public void testCountExpression() {
assertDefaultAccessOnly((new CountExpression("10")).computeExpressionInfo());
}
@@ -192,55 +191,55 @@
public void testEqualsExpression() {
assertDefaultAccessOnly((new EqualsExpression(new Object())).computeExpressionInfo());
}
-
+
public void testInstanceofExpression() {
assertDefaultAccessOnly((new InstanceofExpression("java.lang.Object")).computeExpressionInfo());
}
-
+
public void testNotExpression() {
assertDefaultAccessOnly((new NotExpression(new CountExpression("10"))).computeExpressionInfo());
}
-
+
public void testSystemExpression() {
assertSystemPropertyOnly((new SystemTestExpression("property", "value")).computeExpressionInfo());
}
-
+
public void testTestExpression() {
assertPropertyAccess((new TestExpression("namespace", "property", null,
new Object())).computeExpressionInfo(), "namespace.property", true);
}
-
+
// ---- composite expressions ---------------------------------------------------------
-
+
public void testAdaptExpression() throws Exception {
assertDefaultAccessOnly(new AdaptExpression("java.lang.Object").computeExpressionInfo());
}
-
+
public void testAndExpression() throws Exception {
AndExpression and= new AndExpression();
assertNoAccess(and.computeExpressionInfo());
and.add(new CountExpression("10"));
assertDefaultAccessOnly(and.computeExpressionInfo());
}
-
+
public void testIterateExpression() throws Exception {
assertDefaultAccessOnly(new IterateExpression("or").computeExpressionInfo());
}
-
+
public void testResolveExpression() {
ResolveExpression resolve= new ResolveExpression("variable", null);
assertNoAccess(resolve.computeExpressionInfo());
resolve.add(new CountExpression("10"));
assertVariableAccess(resolve.computeExpressionInfo(), "variable");
}
-
+
public void testWithExpression() {
WithExpression with= new WithExpression("variable");
assertNoAccess(with.computeExpressionInfo());
with.add(new CountExpression("10"));
assertVariableAccess(with.computeExpressionInfo(), "variable");
}
-
+
private void assertDefaultAccessOnly(ExpressionInfo info) {
assertTrue("Accesses default variable", info.hasDefaultVariableAccess());
assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
@@ -256,7 +255,7 @@
assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
}
-
+
private void assertNoAccess(ExpressionInfo info) {
assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
@@ -264,7 +263,7 @@
assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
}
-
+
private void assertVariableAccess(ExpressionInfo info, String variable) {
assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
@@ -274,7 +273,7 @@
assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
}
-
+
private void assertVariableAccess(ExpressionInfo info, String[] variables) {
assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
@@ -286,7 +285,7 @@
assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
assertEquals("No properties accessed", 0, info.getAccessedPropertyNames().length);
}
-
+
private void assertPropertyAccess(ExpressionInfo info, String property, boolean defaultVariable) {
assertEquals("Accesses default variable", defaultVariable, info.hasDefaultVariableAccess());
assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
@@ -296,7 +295,7 @@
assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
assertEquals("No variable accesses", 0, info.getAccessedVariableNames().length);
}
-
+
private void assertPropertyAccess(ExpressionInfo info, String[] properties, boolean defaultVariable) {
assertEquals("Accesses default variable", defaultVariable, info.hasDefaultVariableAccess());
assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
@@ -308,7 +307,7 @@
assertNull("No misbehaving expression types", info.getMisbehavingExpressionTypes());
assertEquals("No variable accesses", 0, info.getAccessedVariableNames().length);
}
-
+
private void assertMisbehavedExpressionTypes(ExpressionInfo info, Class[] types) {
assertFalse("Doesn't accesses default variable", info.hasDefaultVariableAccess());
assertFalse("Doesn't accesses system property", info.hasSystemPropertyAccess());
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java
index 5c6ec45..f868b47 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestPlugin.java
@@ -13,9 +13,9 @@
import org.eclipse.core.runtime.Plugin;
public class ExpressionTestPlugin extends Plugin {
-
+
private static ExpressionTestPlugin fgDefault;
-
+
public ExpressionTestPlugin() {
fgDefault= this;
}
@@ -23,7 +23,7 @@
public static ExpressionTestPlugin getDefault() {
return fgDefault;
}
-
+
public static String getPluginId() {
return "org.eclipse.core.expressions.tests"; //$NON-NLS-1$
}
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 f8b35c4..c72cd1d 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
@@ -60,11 +60,11 @@
public static class CollectionWrapper {
public Collection collection;
}
-
+
public static Test suite() {
return new TestSuite(ExpressionTests.class);
}
-
+
public void testEscape() throws Exception {
assertEquals("Str'ing", Expressions.unEscapeString("Str''ing")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("'", Expressions.unEscapeString("''")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -76,7 +76,7 @@
}
assertTrue(caught);
}
-
+
public void testArgumentConversion() throws Exception {
assertNull(Expressions.convertArgument(null));
assertEquals("", Expressions.convertArgument("")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -93,50 +93,50 @@
assertEquals(new Integer(100), Expressions.convertArgument("100")); //$NON-NLS-1$
assertEquals(new Float(1.7f), Expressions.convertArgument("1.7")); //$NON-NLS-1$
}
-
+
public void testArgumentParsing() throws Exception {
Object[] result= null;
-
+
result= Expressions.parseArguments(""); //$NON-NLS-1$
assertEquals("", result[0]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments("s1"); //$NON-NLS-1$
assertEquals("s1", result[0]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments(" s1 "); //$NON-NLS-1$
assertEquals("s1", result[0]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments("s1,s2"); //$NON-NLS-1$
assertEquals("s1", result[0]); //$NON-NLS-1$
assertEquals("s2", result[1]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments(" s1 , s2 "); //$NON-NLS-1$
assertEquals("s1", result[0]); //$NON-NLS-1$
assertEquals("s2", result[1]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments("' s1 ',' s2 '"); //$NON-NLS-1$
assertEquals(" s1 ", result[0]); //$NON-NLS-1$
assertEquals(" s2 ", result[1]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments(" s1 , ' s2 '"); //$NON-NLS-1$
assertEquals("s1", result[0]); //$NON-NLS-1$
assertEquals(" s2 ", result[1]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments("' s1 ', s2 "); //$NON-NLS-1$
assertEquals(" s1 ", result[0]); //$NON-NLS-1$
assertEquals("s2", result[1]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments("''''"); //$NON-NLS-1$
assertEquals("'", result[0]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments("''',''',','"); //$NON-NLS-1$
assertEquals("','", result[0]); //$NON-NLS-1$
assertEquals(",", result[1]); //$NON-NLS-1$
-
+
result= Expressions.parseArguments("' s1 ', true "); //$NON-NLS-1$
assertEquals(" s1 ", result[0]); //$NON-NLS-1$
assertEquals(Boolean.TRUE, result[1]);
-
+
boolean caught= false;
try {
Expressions.parseArguments("' s1"); //$NON-NLS-1$
@@ -152,13 +152,13 @@
}
assertTrue(caught);
}
-
+
public void testSystemProperty() throws Exception {
SystemTestExpression expression= new SystemTestExpression("os.name", System.getProperty("os.name")); //$NON-NLS-1$ //$NON-NLS-2$
EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Object()));
assertTrue(result == EvaluationResult.TRUE);
}
-
+
public void testAdaptExpression() throws Exception {
AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
expression.add(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
@@ -191,13 +191,13 @@
assertEquals("Equal expressions should have the same hash code",
expression1.hashCode(), expression2.hashCode());
}
-
+
public void testAdaptExpressionFail() throws Exception {
AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.NotExisting"); //$NON-NLS-1$
EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Adaptee()));
assertTrue(result == EvaluationResult.FALSE);
}
-
+
public void testAdaptExpressionFail2() throws Exception {
AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
expression.add(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.NotExisting")); //$NON-NLS-1$
@@ -436,7 +436,7 @@
assertEquals("Equal expressions should have the same hash code",
expression1.hashCode(), expression2.hashCode());
}
-
+
public void testWithExpressionNoVariable() throws Exception {
WithExpression expr = new WithExpression("variable");
expr.add(new EqualsExpression(new Object()));
@@ -456,7 +456,7 @@
context.addVariable("variable", IEvaluationContext.UNDEFINED_VARIABLE);
assertEquals(EvaluationResult.FALSE, expr.evaluate(context));
}
-
+
public void testVariableResolver() throws Exception {
final Object result= new Object();
IVariableResolver resolver= new IVariableResolver() {
@@ -470,33 +470,33 @@
EvaluationContext context= new EvaluationContext(null, new Object(), new IVariableResolver[] { resolver });
assertTrue(result == context.resolveVariable("variable", new Object[] {"arg1", Boolean.TRUE})); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
public void testEqualsExpression() throws Exception {
EqualsExpression exp= new EqualsExpression("name"); //$NON-NLS-1$
EvaluationContext context= new EvaluationContext(null, "name"); //$NON-NLS-1$
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
exp= new EqualsExpression(Boolean.TRUE);
context= new EvaluationContext(null, Boolean.TRUE);
- assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+ assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
+
exp= new EqualsExpression("name"); //$NON-NLS-1$
context= new EvaluationContext(null, Boolean.TRUE);
- assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
+ assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testCountExpressionAnyNumber() throws Exception {
CountExpression exp= new CountExpression("*"); //$NON-NLS-1$
-
+
List list= new ArrayList();
EvaluationContext context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
list.add("two"); //$NON-NLS-1$
@@ -504,21 +504,21 @@
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
-
+
public void testCountExpressionExact() throws Exception {
CountExpression exp= new CountExpression("2"); //$NON-NLS-1$
-
+
List list= new ArrayList();
list.add("one"); //$NON-NLS-1$
EvaluationContext context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
list.add("two"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
list.add("two"); //$NON-NLS-1$
@@ -526,64 +526,64 @@
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testCountExpressionNoneOrOne() throws Exception {
CountExpression exp= new CountExpression("?"); //$NON-NLS-1$
-
+
List list= new ArrayList();
EvaluationContext context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
list.add("two"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testCountExpressionOneOrMore() throws Exception {
CountExpression exp= new CountExpression("+"); //$NON-NLS-1$
-
+
List list= new ArrayList();
EvaluationContext context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
list.add("two"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
-
+
public void testCountExpressionNone() throws Exception {
CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
-
+
List list= new ArrayList();
EvaluationContext context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
-
+
list.clear();
list.add("one"); //$NON-NLS-1$
list.add("two"); //$NON-NLS-1$
context= new EvaluationContext(null, list);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testCountExpressionNoneWithAdapterManager() throws Exception {
CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
@@ -623,25 +623,25 @@
public void testInstanceofTrue() throws Exception {
B b= new B();
EvaluationContext context= new EvaluationContext(null, b);
-
+
InstanceofExpression exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.B"); //$NON-NLS-1$
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.A"); //$NON-NLS-1$
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
-
+
exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.I"); //$NON-NLS-1$
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
-
+
public void testInstanceofFalse() throws Exception {
A a= new A();
EvaluationContext context= new EvaluationContext(null, a);
-
+
InstanceofExpression exp= new InstanceofExpression("org.eclipse.core.internal.expressions.tests.B"); //$NON-NLS-1$
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testIterateExpressionAndTrue() throws Exception {
final List result= new ArrayList();
Expression myExpression= new Expression() {
@@ -659,7 +659,7 @@
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
assertTrue(result.equals(input));
}
-
+
public void testIterateExpressionAndFalse() throws Exception {
final List result= new ArrayList();
Expression myExpression= new Expression() {
@@ -677,7 +677,7 @@
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
assertTrue(result.size() == 1 && result.get(0).equals("one")); //$NON-NLS-1$
}
-
+
public void testIterateExpressionOrTrue() throws Exception {
final List result= new ArrayList();
Expression myExpression= new Expression() {
@@ -695,7 +695,7 @@
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
assertTrue(result.size() == 1 && result.get(0).equals("one")); //$NON-NLS-1$
}
-
+
public void testIterateExpressionOrFalse() throws Exception {
final List result= new ArrayList();
Expression myExpression= new Expression() {
@@ -713,49 +713,49 @@
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
assertTrue(result.equals(input));
}
-
+
public void testIterateExpressionEmptyOr() throws Exception {
IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
List input= new ArrayList();
EvaluationContext context= new EvaluationContext(null, input);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testIterateExpressionEmptyAnd() throws Exception {
IterateExpression exp= new IterateExpression("and"); //$NON-NLS-1$
List input= new ArrayList();
EvaluationContext context= new EvaluationContext(null, input);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
-
+
public void testIterateExpressionAnd_IfEmptyTrue() throws Exception {
IterateExpression exp= new IterateExpression("and", "true"); //$NON-NLS-1$
List input= new ArrayList();
EvaluationContext context= new EvaluationContext(null, input);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
-
+
public void testIterateExpressionAnd_IfEmptyFalse() throws Exception {
IterateExpression exp= new IterateExpression("and", "false"); //$NON-NLS-1$
List input= new ArrayList();
EvaluationContext context= new EvaluationContext(null, input);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testIterateExpressionOr_IfEmptyTrue() throws Exception {
IterateExpression exp= new IterateExpression("or", "true"); //$NON-NLS-1$
List input= new ArrayList();
EvaluationContext context= new EvaluationContext(null, input);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
-
+
public void testIterateExpressionOr_IfEmptyFalse() throws Exception {
IterateExpression exp= new IterateExpression("or", "false"); //$NON-NLS-1$
List input= new ArrayList();
EvaluationContext context= new EvaluationContext(null, input);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
-
+
public void testIterateExpressionWithAdapterManager() throws Exception {
final List result= new ArrayList();
Expression myExpression= new Expression() {
@@ -829,7 +829,7 @@
public void testReadXMLExpression() 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, "test1").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
ExpressionConverter.getDefault().perform(enable);
}
@@ -837,7 +837,7 @@
public void testReadDOMExpression() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
DocumentBuilder builder= DocumentBuilderFactory.newInstance().newDocumentBuilder();
URL url= ExpressionTestPlugin.getDefault().getBundle().getEntry("plugin.xml");
Document document= builder.parse(url.openStream());
@@ -847,7 +847,7 @@
String id = elem.getAttribute("id");
Element enable1= (Element)elem.getElementsByTagName("enablement").item(0);
IConfigurationElement enable2= findExtension(ces, id).getChildren("enablement")[0]; //$NON-NLS-1$
-
+
Expression exp1= ExpressionConverter.getDefault().perform(enable1);
Expression exp2= ExpressionConverter.getDefault().perform(enable2);
assertEquals(exp1, exp2);
@@ -857,7 +857,7 @@
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();
@@ -873,7 +873,7 @@
public void testPlatformPropertyTester() 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, "test3").getChildren("enablement")[0]; //$NON-NLS-1$ //$NON-NLS-2$
Expression exp= ExpressionConverter.getDefault().perform(enable);
EvaluationContext context = new EvaluationContext(null, Platform.class);
@@ -887,8 +887,8 @@
}
return null;
}
-
-
+
+
public void testDefinitionExpression() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions", "definitions");
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java
index cc37ec5..e70269a 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/I_TypeExtender.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions.tests;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+
public class I_TypeExtender extends PropertyTester {
public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
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 f305a5f..90995bb 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
@@ -14,46 +14,45 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
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;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
public class PropertyTesterTests extends TestCase {
-
+
private A a;
private B b;
private I i;
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);
}
-
+
protected void setUp() throws Exception {
a= new A();
b= new B();
i= b;
}
-
+
public void testSimple() throws Exception {
assertTrue(test(a, "simple", null,"simple")); //$NON-NLS-1$ //$NON-NLS-2$
// second pass to check if cache is populated correctly
assertTrue(test(a, "simple", null,"simple")); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
public void testInherited() throws Exception {
assertTrue(test(b, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(test(i, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -61,7 +60,7 @@
assertTrue(test(b, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(test(i, "simple", null, "simple")); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
public void testUnknown() throws Exception {
try {
test(a, "unknown", null, null); //$NON-NLS-1$
@@ -70,7 +69,7 @@
}
assertTrue(false);
}
-
+
public void testOverridden() throws Exception {
assertTrue(test(a, "overridden", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(test(b, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -83,7 +82,7 @@
assertTrue(test(b_as_a, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(test(i, "overridden", null, "B")); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
public void testOdering() throws Exception {
assertTrue(test(b, "ordering", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
I other= new I() {};
@@ -92,13 +91,13 @@
assertTrue(test(b, "ordering", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(test(other, "ordering", null, "I")); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
public void testChaining() throws Exception {
assertTrue(test(a, "chaining", null, "A2")); //$NON-NLS-1$ //$NON-NLS-2$
// second pass to check if cache is populated correctly
assertTrue(test(a, "chaining", null, "A2")); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
// This test is questionable. It depends on if core runtime can
// guaratee any ordering in the plug-in registry.
public void testChainOrdering() throws Exception {
@@ -106,20 +105,20 @@
// second pass to check if cache is populated correctly
assertTrue(test(a, "chainOrdering", null, "A")); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
public void testWrongNameSpace() throws Exception {
try {
test(a, "differentNamespace", null, null); //$NON-NLS-1$
} catch (CoreException e) {
return;
}
- assertTrue(false);
+ assertTrue(false);
}
-
+
public void testDynamicPlugin() throws Exception {
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());
@@ -142,14 +141,14 @@
}
assertTrue("Core exception not thrown", exception);
}
-
+
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);
@@ -158,14 +157,14 @@
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 testPlatformTester() throws Exception {
TestExpression exp = new TestExpression("org.eclipse.core.runtime",
"bundleState",
@@ -174,20 +173,20 @@
EvaluationResult result= exp.evaluate(context);
assertEquals(EvaluationResult.TRUE, result);
}
-
+
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$
}
-
+
private boolean test(Object receiver, String property, Object[] args, Object expectedValue) throws CoreException {
Property p= fgManager.getProperty(receiver, "org.eclipse.core.internal.expressions.tests", property); //$NON-NLS-1$
assertTrue(p.isInstantiated());
return p.test(receiver, args, expectedValue);
}
-
+
private boolean test(String namespace, Object receiver, String property, Object[] args, Object expectedValue) throws CoreException {
Property p= fgManager.getProperty(receiver, namespace, property);
assertTrue(p.isInstantiated());
return p.test(receiver, args, expectedValue);
- }
+ }
}