Bug 116921 - [expressions] Provide AndExpression and others as API
Moved ReferenceExpression, CountExpression, EqualsExpression and
TestExpression to API package.
Change-Id: I2d24313949d5ebcbea155ceb058a79a7c3c24c1f
Signed-off-by: Rolf Theunissen <rolf.theunissen@gmail.com>
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/CountExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/CountExpression.java
new file mode 100644
index 0000000..381d1e0
--- /dev/null
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/CountExpression.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008, 2009 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation.
+ * Ian Phillips - additional expressions support ( "-N)", "(N-" ).
+ *******************************************************************************/
+package org.eclipse.core.expressions;
+
+import java.util.Collection;
+
+import org.w3c.dom.Element;
+
+import org.eclipse.core.internal.expressions.Expressions;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+
+/**
+ * @since 3.7
+ */
+public class CountExpression extends Expression {
+
+ private static final int GREATER_THAN = 7; // (N-
+ private static final int LESS_THAN = 6; // -N)
+ private static final int ANY_NUMBER = 5; // *
+ private static final int EXACT = 4; // N
+ private static final int ONE_OR_MORE = 3; // +
+ private static final int NONE_OR_ONE = 2; // ?
+ private static final int NONE = 1; // !
+ private static final int UNKNOWN = 0;
+
+ /**
+ * 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);
+ }
+
+ public CountExpression(Element element) {
+ String size = element.getAttribute(ATT_VALUE);
+ initializeSize(size.isEmpty() ? null : size);
+ }
+
+ public CountExpression(String size) {
+ initializeSize(size);
+ }
+
+ private void initializeSize(String size) {
+ if (size == null)
+ size= "*"; //$NON-NLS-1$
+ if ("*".equals(size)) //$NON-NLS-1$
+ fMode= ANY_NUMBER;
+ else if ("?".equals(size)) //$NON-NLS-1$
+ fMode= NONE_OR_ONE;
+ else if ("!".equals(size)) //$NON-NLS-1$
+ fMode= NONE;
+ else if ("+".equals(size)) //$NON-NLS-1$
+ fMode= ONE_OR_MORE;
+ else if (size.charAt(0) == '-' && size.charAt(size.length() - 1) == ')') {
+ try {
+ fMode = LESS_THAN;
+ fSize = Integer.parseInt(size.substring(1, size.length() - 1));
+ } catch (NumberFormatException e) {
+ fMode= UNKNOWN;
+ }
+ } else if (size.charAt(0) == '(' && size.charAt(size.length() - 1) == '-') {
+ try {
+ fMode = GREATER_THAN;
+ fSize = Integer.parseInt(size.substring(1, size.length() - 1));
+ } catch (NumberFormatException e) {
+ fMode= UNKNOWN;
+ }
+ } else {
+ try {
+ fSize= Integer.parseInt(size);
+ fMode= EXACT;
+ } catch (NumberFormatException e) {
+ fMode= UNKNOWN;
+ }
+ }
+ }
+
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ Object var= context.getDefaultVariable();
+ int size;
+ if (var instanceof Collection) {
+ size= ((Collection<?>)var).size();
+ } else {
+ ICountable countable= Expressions.getAsICountable(var, this);
+ if (countable == null)
+ return EvaluationResult.NOT_LOADED;
+ size= countable.count();
+ }
+ switch (fMode) {
+ case UNKNOWN:
+ return EvaluationResult.FALSE;
+ case NONE:
+ return EvaluationResult.valueOf(size == 0);
+ case NONE_OR_ONE:
+ return EvaluationResult.valueOf(size == 0 || size == 1);
+ case ONE_OR_MORE:
+ return EvaluationResult.valueOf(size >= 1);
+ case EXACT:
+ return EvaluationResult.valueOf(fSize == size);
+ case ANY_NUMBER:
+ return EvaluationResult.TRUE;
+ case LESS_THAN:
+ return EvaluationResult.valueOf(size < fSize);
+ case GREATER_THAN:
+ return EvaluationResult.valueOf(size > fSize);
+ }
+ return EvaluationResult.FALSE;
+ }
+
+ @Override
+ public void collectExpressionInfo(ExpressionInfo info) {
+ info.markDefaultVariableAccessed();
+ }
+
+ @Override
+ 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);
+ }
+
+ @Override
+ protected int computeHashCode() {
+ return HASH_INITIAL * HASH_FACTOR + fMode
+ * HASH_FACTOR + fSize;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder(getClass().getSimpleName());
+ builder.append(" [ size="); //$NON-NLS-1$
+ builder.append(fSize);
+ builder.append(", mode: "); //$NON-NLS-1$
+ builder.append(fMode);
+ switch (fMode) {
+ case GREATER_THAN:
+ builder.append(" GREATER_THAN"); //$NON-NLS-1$
+ break;
+ case LESS_THAN:
+ builder.append(" LESS_THAN"); //$NON-NLS-1$ // -N)
+ break;
+ case ANY_NUMBER:
+ builder.append(" ANY_NUMBER"); //$NON-NLS-1$ // *
+ break;
+ case EXACT:
+ builder.append(" EXACT"); //$NON-NLS-1$ // N
+ break;
+ case ONE_OR_MORE:
+ builder.append(" ONE_OR_MORE"); //$NON-NLS-1$ // +
+ break;
+ case NONE_OR_ONE:
+ builder.append(" NONE_OR_ONE"); //$NON-NLS-1$ // ?
+ break;
+ case NONE:
+ builder.append(" NONE"); //$NON-NLS-1$ // !
+ break;
+ case UNKNOWN:
+ builder.append(" UNKNOWN"); //$NON-NLS-1$ ;
+ break;
+ default:
+ break;
+ }
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
+ }
+
+}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EqualsExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EqualsExpression.java
new file mode 100644
index 0000000..9f9ccaf
--- /dev/null
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/EqualsExpression.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.expressions;
+
+import org.w3c.dom.Element;
+
+import org.eclipse.core.internal.expressions.Expressions;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * @since 3.7
+ */
+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;
+
+ 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);
+ fExpectedValue= Expressions.convertArgument(value);
+ }
+
+ public EqualsExpression(Element element) throws CoreException {
+ String value= element.getAttribute(ATT_VALUE);
+ Expressions.checkAttribute(ATT_VALUE, value.isEmpty() ? null : value);
+ fExpectedValue= Expressions.convertArgument(value);
+ }
+
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ Object element= context.getDefaultVariable();
+ return EvaluationResult.valueOf(element.equals(fExpectedValue));
+ }
+
+ @Override
+ public void collectExpressionInfo(ExpressionInfo info) {
+ info.markDefaultVariableAccessed();
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (!(object instanceof EqualsExpression))
+ return false;
+
+ final EqualsExpression that= (EqualsExpression)object;
+ return this.fExpectedValue.equals(that.fExpectedValue);
+ }
+
+ @Override
+ protected int computeHashCode() {
+ return HASH_INITIAL * HASH_FACTOR + fExpectedValue.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder(getClass().getSimpleName());
+ builder.append(" [expected="); //$NON-NLS-1$
+ builder.append(fExpectedValue);
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
+ }
+}
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ReferenceExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ReferenceExpression.java
new file mode 100644
index 0000000..6c15b73
--- /dev/null
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/ReferenceExpression.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.expressions;
+
+import org.w3c.dom.Element;
+
+import org.eclipse.core.internal.expressions.DefinitionRegistry;
+import org.eclipse.core.internal.expressions.Expressions;
+
+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.7
+ */
+public class ReferenceExpression extends Expression {
+
+ // consider making this a more general extension manager
+ // for now it's just part of the reference expression
+ private static DefinitionRegistry fgDefinitionRegistry= null;
+
+ private static DefinitionRegistry getDefinitionRegistry() {
+ if (fgDefinitionRegistry == null) {
+ fgDefinitionRegistry= new DefinitionRegistry();
+ }
+ return fgDefinitionRegistry;
+ }
+
+ private static final String ATT_DEFINITION_ID= "definitionId"; //$NON-NLS-1$
+
+ /**
+ * The seed for the hash code for all equals expressions.
+ */
+ private static final int HASH_INITIAL= ReferenceExpression.class.getName().hashCode();
+
+ private String fDefinitionId;
+
+ public ReferenceExpression(String definitionId) {
+ Assert.isNotNull(definitionId);
+ fDefinitionId= definitionId;
+ }
+
+ public ReferenceExpression(IConfigurationElement element) throws CoreException {
+ fDefinitionId= element.getAttribute(ATT_DEFINITION_ID);
+ Expressions.checkAttribute(ATT_DEFINITION_ID, fDefinitionId);
+ }
+
+ public ReferenceExpression(Element element) throws CoreException {
+ fDefinitionId= element.getAttribute(ATT_DEFINITION_ID);
+ Expressions.checkAttribute(ATT_DEFINITION_ID, fDefinitionId.isEmpty() ? null : fDefinitionId);
+ }
+
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ Expression expr= getDefinitionRegistry().getExpression(fDefinitionId);
+ return expr.evaluate(context);
+ }
+
+ @Override
+ public void collectExpressionInfo(ExpressionInfo info) {
+ Expression expr;
+ try {
+ expr= getDefinitionRegistry().getExpression(fDefinitionId);
+ } catch (CoreException e) {
+ // We didn't find the expression definition. So no
+ // expression info can be collected.
+ return;
+ }
+ expr.collectExpressionInfo(info);
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (!(object instanceof ReferenceExpression))
+ return false;
+
+ final ReferenceExpression that= (ReferenceExpression)object;
+ return this.fDefinitionId.equals(that.fDefinitionId);
+ }
+
+ @Override
+ protected int computeHashCode() {
+ return HASH_INITIAL * HASH_FACTOR + fDefinitionId.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder(getClass().getSimpleName());
+ builder.append(" [definitionId="); //$NON-NLS-1$
+ builder.append(fDefinitionId);
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/TestExpression.java b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/TestExpression.java
new file mode 100644
index 0000000..4f86217
--- /dev/null
+++ b/bundles/org.eclipse.core.expressions/src/org/eclipse/core/expressions/TestExpression.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.expressions;
+
+import org.w3c.dom.Element;
+
+import org.eclipse.core.internal.expressions.ExpressionMessages;
+import org.eclipse.core.internal.expressions.ExpressionStatus;
+import org.eclipse.core.internal.expressions.Expressions;
+import org.eclipse.core.internal.expressions.Property;
+import org.eclipse.core.internal.expressions.TypeExtensionManager;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * @since 3.7
+ */
+public class TestExpression extends Expression {
+
+ private String fNamespace;
+ private String fProperty;
+ 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$
+ private static final String ATT_FORCE_PLUGIN_ACTIVATION= "forcePluginActivation"; //$NON-NLS-1$
+ /**
+ * 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));
+ }
+ fNamespace= property.substring(0, pos);
+ fProperty= property.substring(pos + 1);
+ fArgs= Expressions.getArguments(element, ATT_ARGS);
+ fExpectedValue= Expressions.convertArgument(element.getAttribute(ATT_VALUE));
+ fForcePluginActivation= Expressions.getOptionalBooleanAttribute(element, ATT_FORCE_PLUGIN_ACTIVATION);
+ }
+
+ public TestExpression(Element 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));
+ }
+ fNamespace= property.substring(0, pos);
+ fProperty= property.substring(pos + 1);
+ fArgs= Expressions.getArguments(element, ATT_ARGS);
+ String value = element.getAttribute(ATT_VALUE);
+ fExpectedValue = Expressions.convertArgument(value.isEmpty() ? null : value);
+ fForcePluginActivation= Expressions.getOptionalBooleanAttribute(element, ATT_FORCE_PLUGIN_ACTIVATION);
+ }
+
+ public TestExpression(String namespace, String property, Object[] args, Object expectedValue) {
+ this(namespace, property, args, expectedValue, false);
+ }
+
+ public TestExpression(String namespace, String property, Object[] args, Object expectedValue, boolean forcePluginActivation) {
+ Assert.isNotNull(namespace);
+ Assert.isNotNull(property);
+ fNamespace= namespace;
+ fProperty= property;
+ fArgs= args != null ? args : Expressions.EMPTY_ARGS;
+ fExpectedValue= expectedValue;
+ fForcePluginActivation= forcePluginActivation;
+ }
+
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ Object element= context.getDefaultVariable();
+ if (System.class.equals(element)) {
+ String str= System.getProperty(fProperty);
+ if (str == null)
+ return EvaluationResult.FALSE;
+ return EvaluationResult.valueOf(str.equals(fArgs[0]));
+ }
+ Property property= fgTypeExtensionManager.getProperty(element, fNamespace, fProperty, context.getAllowPluginActivation() && fForcePluginActivation);
+ if (!property.isInstantiated())
+ return EvaluationResult.NOT_LOADED;
+ return EvaluationResult.valueOf(property.test(element, fArgs, fExpectedValue));
+ }
+
+ @Override
+ public void collectExpressionInfo(ExpressionInfo info) {
+ info.markDefaultVariableAccessed();
+ info.addAccessedPropertyName(fNamespace + PROP_SEP + fProperty);
+ }
+
+ @Override
+ 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)
+ && this.fForcePluginActivation == that.fForcePluginActivation
+ && equals(this.fArgs, that.fArgs) && equals(this.fExpectedValue, that.fExpectedValue);
+ }
+
+ @Override
+ protected int computeHashCode() {
+ return HASH_INITIAL * HASH_FACTOR + hashCode(fArgs)
+ * HASH_FACTOR + hashCode(fExpectedValue)
+ * HASH_FACTOR + fNamespace.hashCode()
+ * HASH_FACTOR + fProperty.hashCode()
+ * HASH_FACTOR + (fForcePluginActivation ? 1 : 0);
+ }
+
+ //---- Debugging ---------------------------------------------------
+
+ @Override
+ public String toString() {
+ StringBuilder args= new StringBuilder();
+ for (int i= 0; i < fArgs.length; i++) {
+ Object arg= fArgs[i];
+ if (arg instanceof String) {
+ args.append('\'');
+ args.append(arg);
+ args.append('\'');
+ } else {
+ args.append(arg.toString());
+ }
+ if (i < fArgs.length - 1)
+ args.append(", "); //$NON-NLS-1$
+ }
+ return "<test property=\"" + fProperty + "\"" +//$NON-NLS-1$ //$NON-NLS-2$
+ (fArgs.length != 0 ? " args=\"" + args + "\"" : "") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ (fExpectedValue != null ? " value=\"" + fExpectedValue + "\"" : "") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ " plug-in activation: " + (fForcePluginActivation ? "eager" : "lazy") + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ "/>"; //$NON-NLS-1$
+ }
+
+ //---- testing ---------------------------------------------------
+
+ public boolean testGetForcePluginActivation() {
+ return fForcePluginActivation;
+ }
+
+ public static TypeExtensionManager testGetTypeExtensionManager() {
+ return fgTypeExtensionManager;
+ }
+}
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 7aaaa5b..f550cbd 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,178 +14,23 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions;
-import java.util.Collection;
-
import org.w3c.dom.Element;
-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 {
-
- private static final int GREATER_THAN = 7; // (N-
- private static final int LESS_THAN = 6; // -N)
- private static final int ANY_NUMBER = 5; // *
- private static final int EXACT = 4; // N
- private static final int ONE_OR_MORE = 3; // +
- private static final int NONE_OR_ONE = 2; // ?
- private static final int NONE = 1; // !
- private static final int UNKNOWN = 0;
-
- /**
- * 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;
+@Deprecated
+public class CountExpression extends org.eclipse.core.expressions.CountExpression {
public CountExpression(IConfigurationElement configElement) {
- String size = configElement.getAttribute(ATT_VALUE);
- initializeSize(size);
+ super(configElement);
}
public CountExpression(Element element) {
- String size = element.getAttribute(ATT_VALUE);
- initializeSize(size.isEmpty() ? null : size);
+ super(element);
}
public CountExpression(String size) {
- initializeSize(size);
- }
-
- private void initializeSize(String size) {
- if (size == null)
- size= "*"; //$NON-NLS-1$
- if ("*".equals(size)) //$NON-NLS-1$
- fMode= ANY_NUMBER;
- else if ("?".equals(size)) //$NON-NLS-1$
- fMode= NONE_OR_ONE;
- else if ("!".equals(size)) //$NON-NLS-1$
- fMode= NONE;
- else if ("+".equals(size)) //$NON-NLS-1$
- fMode= ONE_OR_MORE;
- else if (size.charAt(0) == '-' && size.charAt(size.length() - 1) == ')') {
- try {
- fMode = LESS_THAN;
- fSize = Integer.parseInt(size.substring(1, size.length() - 1));
- } catch (NumberFormatException e) {
- fMode= UNKNOWN;
- }
- } else if (size.charAt(0) == '(' && size.charAt(size.length() - 1) == '-') {
- try {
- fMode = GREATER_THAN;
- fSize = Integer.parseInt(size.substring(1, size.length() - 1));
- } catch (NumberFormatException e) {
- fMode= UNKNOWN;
- }
- } else {
- try {
- fSize= Integer.parseInt(size);
- fMode= EXACT;
- } catch (NumberFormatException e) {
- fMode= UNKNOWN;
- }
- }
- }
-
- @Override
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object var= context.getDefaultVariable();
- int size;
- if (var instanceof Collection) {
- size= ((Collection<?>)var).size();
- } else {
- ICountable countable= Expressions.getAsICountable(var, this);
- if (countable == null)
- return EvaluationResult.NOT_LOADED;
- size= countable.count();
- }
- switch (fMode) {
- case UNKNOWN:
- return EvaluationResult.FALSE;
- case NONE:
- return EvaluationResult.valueOf(size == 0);
- case NONE_OR_ONE:
- return EvaluationResult.valueOf(size == 0 || size == 1);
- case ONE_OR_MORE:
- return EvaluationResult.valueOf(size >= 1);
- case EXACT:
- return EvaluationResult.valueOf(fSize == size);
- case ANY_NUMBER:
- return EvaluationResult.TRUE;
- case LESS_THAN:
- return EvaluationResult.valueOf(size < fSize);
- case GREATER_THAN:
- return EvaluationResult.valueOf(size > fSize);
- }
- return EvaluationResult.FALSE;
- }
-
- @Override
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- }
-
- @Override
- 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);
- }
-
- @Override
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fMode
- * HASH_FACTOR + fSize;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder(getClass().getSimpleName());
- builder.append(" [ size="); //$NON-NLS-1$
- builder.append(fSize);
- builder.append(", mode: "); //$NON-NLS-1$
- builder.append(fMode);
- switch (fMode) {
- case GREATER_THAN:
- builder.append(" GREATER_THAN"); //$NON-NLS-1$
- break;
- case LESS_THAN:
- builder.append(" LESS_THAN"); //$NON-NLS-1$ // -N)
- break;
- case ANY_NUMBER:
- builder.append(" ANY_NUMBER"); //$NON-NLS-1$ // *
- break;
- case EXACT:
- builder.append(" EXACT"); //$NON-NLS-1$ // N
- break;
- case ONE_OR_MORE:
- builder.append(" ONE_OR_MORE"); //$NON-NLS-1$ // +
- break;
- case NONE_OR_ONE:
- builder.append(" NONE_OR_ONE"); //$NON-NLS-1$ // ?
- break;
- case NONE:
- builder.append(" NONE"); //$NON-NLS-1$ // !
- break;
- case UNKNOWN:
- builder.append(" UNKNOWN"); //$NON-NLS-1$ ;
- break;
- default:
- break;
- }
- builder.append("]"); //$NON-NLS-1$
- return builder.toString();
+ super(size);
}
}
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 b976678..c193894 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
@@ -15,71 +15,22 @@
import org.w3c.dom.Element;
-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;
+@Deprecated
+public class EqualsExpression extends org.eclipse.core.expressions.EqualsExpression {
public EqualsExpression(Object expectedValue) {
- Assert.isNotNull(expectedValue);
- fExpectedValue= expectedValue;
+ super(expectedValue);
}
public EqualsExpression(IConfigurationElement element) throws CoreException {
- String value= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, value);
- fExpectedValue= Expressions.convertArgument(value);
+ super(element);
}
public EqualsExpression(Element element) throws CoreException {
- String value= element.getAttribute(ATT_VALUE);
- Expressions.checkAttribute(ATT_VALUE, value.isEmpty() ? null : value);
- fExpectedValue= Expressions.convertArgument(value);
+ super(element);
}
- @Override
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object element= context.getDefaultVariable();
- return EvaluationResult.valueOf(element.equals(fExpectedValue));
- }
-
- @Override
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- }
-
- @Override
- public boolean equals(final Object object) {
- if (!(object instanceof EqualsExpression))
- return false;
-
- final EqualsExpression that= (EqualsExpression)object;
- return this.fExpectedValue.equals(that.fExpectedValue);
- }
-
- @Override
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fExpectedValue.hashCode();
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder(getClass().getSimpleName());
- builder.append(" [expected="); //$NON-NLS-1$
- builder.append(fExpectedValue);
- builder.append("]"); //$NON-NLS-1$
- return builder.toString();
- }
}
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 d5b2eea..c573cc6 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
@@ -15,98 +15,21 @@
import org.w3c.dom.Element;
-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 {
-
- // consider making this a more general extension manager
- // for now it's just part of the reference expression
- private static DefinitionRegistry fgDefinitionRegistry= null;
-
- private static DefinitionRegistry getDefinitionRegistry() {
- if (fgDefinitionRegistry == null) {
- fgDefinitionRegistry= new DefinitionRegistry();
- }
- return fgDefinitionRegistry;
- }
-
- private static final String ATT_DEFINITION_ID= "definitionId"; //$NON-NLS-1$
-
- /**
- * The seed for the hash code for all equals expressions.
- */
- private static final int HASH_INITIAL= ReferenceExpression.class.getName().hashCode();
-
- private String fDefinitionId;
+@Deprecated
+public class ReferenceExpression extends org.eclipse.core.expressions.ReferenceExpression {
public ReferenceExpression(String definitionId) {
- Assert.isNotNull(definitionId);
- fDefinitionId= definitionId;
+ super(definitionId);
}
public ReferenceExpression(IConfigurationElement element) throws CoreException {
- fDefinitionId= element.getAttribute(ATT_DEFINITION_ID);
- Expressions.checkAttribute(ATT_DEFINITION_ID, fDefinitionId);
+ super(element);
}
public ReferenceExpression(Element element) throws CoreException {
- fDefinitionId= element.getAttribute(ATT_DEFINITION_ID);
- Expressions.checkAttribute(ATT_DEFINITION_ID, fDefinitionId.isEmpty() ? null : fDefinitionId);
- }
-
- @Override
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Expression expr= getDefinitionRegistry().getExpression(fDefinitionId);
- return expr.evaluate(context);
- }
-
- @Override
- public void collectExpressionInfo(ExpressionInfo info) {
- Expression expr;
- try {
- expr= getDefinitionRegistry().getExpression(fDefinitionId);
- } catch (CoreException e) {
- // We didn't find the expression definition. So no
- // expression info can be collected.
- return;
- }
- expr.collectExpressionInfo(info);
- }
-
- @Override
- public boolean equals(final Object object) {
- if (!(object instanceof ReferenceExpression))
- return false;
-
- final ReferenceExpression that= (ReferenceExpression)object;
- return this.fDefinitionId.equals(that.fDefinitionId);
- }
-
- @Override
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + fDefinitionId.hashCode();
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder(getClass().getSimpleName());
- builder.append(" [definitionId="); //$NON-NLS-1$
- builder.append(fDefinitionId);
- builder.append("]"); //$NON-NLS-1$
- return builder.toString();
+ super(element);
}
}
\ No newline at end of file
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 50d7509..3c2e062 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
@@ -16,10 +16,14 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.eclipse.core.expressions.CountExpression;
import org.eclipse.core.expressions.ElementHandler;
+import org.eclipse.core.expressions.EqualsExpression;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.expressions.ExpressionTagNames;
+import org.eclipse.core.expressions.ReferenceExpression;
+import org.eclipse.core.expressions.TestExpression;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
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 5280469..1d05cb4 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
@@ -15,151 +15,26 @@
import org.w3c.dom.Element;
-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;
- private String fProperty;
- 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$
- private static final String ATT_FORCE_PLUGIN_ACTIVATION= "forcePluginActivation"; //$NON-NLS-1$
- /**
- * 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$
+@Deprecated
+public class TestExpression extends org.eclipse.core.expressions.TestExpression {
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));
- }
- fNamespace= property.substring(0, pos);
- fProperty= property.substring(pos + 1);
- fArgs= Expressions.getArguments(element, ATT_ARGS);
- fExpectedValue= Expressions.convertArgument(element.getAttribute(ATT_VALUE));
- fForcePluginActivation= Expressions.getOptionalBooleanAttribute(element, ATT_FORCE_PLUGIN_ACTIVATION);
+ super(element);
}
public TestExpression(Element 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));
- }
- fNamespace= property.substring(0, pos);
- fProperty= property.substring(pos + 1);
- fArgs= Expressions.getArguments(element, ATT_ARGS);
- String value = element.getAttribute(ATT_VALUE);
- fExpectedValue = Expressions.convertArgument(value.isEmpty() ? null : value);
- fForcePluginActivation= Expressions.getOptionalBooleanAttribute(element, ATT_FORCE_PLUGIN_ACTIVATION);
+ super(element);
}
public TestExpression(String namespace, String property, Object[] args, Object expectedValue) {
- this(namespace, property, args, expectedValue, false);
+ super(namespace, property, args, expectedValue);
}
public TestExpression(String namespace, String property, Object[] args, Object expectedValue, boolean forcePluginActivation) {
- Assert.isNotNull(namespace);
- Assert.isNotNull(property);
- fNamespace= namespace;
- fProperty= property;
- fArgs= args != null ? args : Expressions.EMPTY_ARGS;
- fExpectedValue= expectedValue;
- fForcePluginActivation= forcePluginActivation;
+ super(namespace, property, args, expectedValue, forcePluginActivation);
}
- @Override
- public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
- Object element= context.getDefaultVariable();
- if (System.class.equals(element)) {
- String str= System.getProperty(fProperty);
- if (str == null)
- return EvaluationResult.FALSE;
- return EvaluationResult.valueOf(str.equals(fArgs[0]));
- }
- Property property= fgTypeExtensionManager.getProperty(element, fNamespace, fProperty, context.getAllowPluginActivation() && fForcePluginActivation);
- if (!property.isInstantiated())
- return EvaluationResult.NOT_LOADED;
- return EvaluationResult.valueOf(property.test(element, fArgs, fExpectedValue));
- }
-
- @Override
- public void collectExpressionInfo(ExpressionInfo info) {
- info.markDefaultVariableAccessed();
- info.addAccessedPropertyName(fNamespace + PROP_SEP + fProperty);
- }
-
- @Override
- 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)
- && this.fForcePluginActivation == that.fForcePluginActivation
- && equals(this.fArgs, that.fArgs) && equals(this.fExpectedValue, that.fExpectedValue);
- }
-
- @Override
- protected int computeHashCode() {
- return HASH_INITIAL * HASH_FACTOR + hashCode(fArgs)
- * HASH_FACTOR + hashCode(fExpectedValue)
- * HASH_FACTOR + fNamespace.hashCode()
- * HASH_FACTOR + fProperty.hashCode()
- * HASH_FACTOR + (fForcePluginActivation ? 1 : 0);
- }
-
- //---- Debugging ---------------------------------------------------
-
- @Override
- public String toString() {
- StringBuilder args= new StringBuilder();
- for (int i= 0; i < fArgs.length; i++) {
- Object arg= fArgs[i];
- if (arg instanceof String) {
- args.append('\'');
- args.append(arg);
- args.append('\'');
- } else {
- args.append(arg.toString());
- }
- if (i < fArgs.length - 1)
- args.append(", "); //$NON-NLS-1$
- }
- return "<test property=\"" + fProperty + "\"" +//$NON-NLS-1$ //$NON-NLS-2$
- (fArgs.length != 0 ? " args=\"" + args + "\"" : "") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- (fExpectedValue != null ? " value=\"" + fExpectedValue + "\"" : "") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- " plug-in activation: " + (fForcePluginActivation ? "eager" : "lazy") + //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- "/>"; //$NON-NLS-1$
- }
-
- //---- testing ---------------------------------------------------
-
- public boolean testGetForcePluginActivation() {
- return fForcePluginActivation;
- }
-
- public static TypeExtensionManager testGetTypeExtensionManager() {
- return fgTypeExtensionManager;
- }
}
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CountExpressionTest.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CountExpressionTest.java
index d1ee845..358d899 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CountExpressionTest.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/CountExpressionTest.java
@@ -18,9 +18,9 @@
import org.junit.Assert;
+import org.eclipse.core.expressions.CountExpression;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.internal.expressions.CountExpression;
import org.eclipse.core.runtime.CoreException;
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 da066fc..9aba1de 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
@@ -17,17 +17,17 @@
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.core.expressions.CountExpression;
+import org.eclipse.core.expressions.EqualsExpression;
import org.eclipse.core.expressions.ExpressionInfo;
+import org.eclipse.core.expressions.TestExpression;
import org.eclipse.core.internal.expressions.AdaptExpression;
import org.eclipse.core.internal.expressions.AndExpression;
-import org.eclipse.core.internal.expressions.CountExpression;
-import org.eclipse.core.internal.expressions.EqualsExpression;
import org.eclipse.core.internal.expressions.InstanceofExpression;
import org.eclipse.core.internal.expressions.IterateExpression;
import org.eclipse.core.internal.expressions.NotExpression;
import org.eclipse.core.internal.expressions.ResolveExpression;
import org.eclipse.core.internal.expressions.SystemTestExpression;
-import org.eclipse.core.internal.expressions.TestExpression;
import org.eclipse.core.internal.expressions.WithExpression;
import junit.framework.Test;
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 4d8061a..ab3e0ca 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
@@ -40,17 +40,18 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import org.eclipse.core.expressions.CountExpression;
+import org.eclipse.core.expressions.EqualsExpression;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.expressions.IVariableResolver;
+import org.eclipse.core.expressions.TestExpression;
import org.eclipse.core.internal.expressions.AdaptExpression;
import org.eclipse.core.internal.expressions.AndExpression;
-import org.eclipse.core.internal.expressions.CountExpression;
import org.eclipse.core.internal.expressions.EnablementExpression;
-import org.eclipse.core.internal.expressions.EqualsExpression;
import org.eclipse.core.internal.expressions.ExpressionStatus;
import org.eclipse.core.internal.expressions.Expressions;
import org.eclipse.core.internal.expressions.InstanceofExpression;
@@ -59,7 +60,6 @@
import org.eclipse.core.internal.expressions.OrExpression;
import org.eclipse.core.internal.expressions.ResolveExpression;
import org.eclipse.core.internal.expressions.SystemTestExpression;
-import org.eclipse.core.internal.expressions.TestExpression;
import org.eclipse.core.internal.expressions.WithExpression;
import org.eclipse.core.runtime.CoreException;
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 a565003..d805874 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
@@ -21,8 +21,8 @@
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.TestExpression;
import org.eclipse.core.internal.expressions.Property;
-import org.eclipse.core.internal.expressions.TestExpression;
import org.eclipse.core.internal.expressions.TypeExtensionManager;
import org.eclipse.core.runtime.CoreException;