use of org.eclipse.core.expressions.EvaluationContext in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionWithAdapterManagerEmptyOr.
public void testIterateExpressionWithAdapterManagerEmptyOr() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("or");
final List<String> input = new ArrayList<>();
CollectionWrapper wrapper = new CollectionWrapper();
wrapper.collection = input;
EvaluationContext context = new EvaluationContext(null, wrapper);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
use of org.eclipse.core.expressions.EvaluationContext in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionWithAdapterManagerEmptyAnd.
public void testIterateExpressionWithAdapterManagerEmptyAnd() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("and");
final List<String> input = new ArrayList<>();
CollectionWrapper wrapper = new CollectionWrapper();
wrapper.collection = input;
EvaluationContext context = new EvaluationContext(null, wrapper);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
use of org.eclipse.core.expressions.EvaluationContext in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionAnd_IfEmptyTrue.
public void testIterateExpressionAnd_IfEmptyTrue() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("and", "true");
List<?> input = new ArrayList<>();
EvaluationContext context = new EvaluationContext(null, input);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
use of org.eclipse.core.expressions.EvaluationContext in project eclipse.platform.runtime by eclipse.
the class PropertyTesterTests method testPluginActivation.
public void testPluginActivation() throws Exception {
if (TEST_DYNAMIC_AND_ACTIVATION) {
// $NON-NLS-1$
Bundle bundle = Platform.getBundle("org.eclipse.core.expressions.tests.forceActivation");
assertEquals(Bundle.STARTING, bundle.getState());
A receiver = new A();
TestExpression exp = new TestExpression("org.eclipse.core.expressions.tests.forceActivation", "testing", null, null, true);
EvaluationContext context = new EvaluationContext(null, receiver);
EvaluationResult result = exp.evaluate(context);
assertEquals(EvaluationResult.NOT_LOADED, result);
assertEquals(Bundle.STARTING, bundle.getState());
// $NON-NLS-1$ //$NON-NLS-2$
Property p = TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false);
assertTrue(!p.isInstantiated());
context.setAllowPluginActivation(true);
exp.evaluate(context);
assertEquals(Bundle.ACTIVE, bundle.getState());
// $NON-NLS-1$ //$NON-NLS-2$
p = TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false);
assertTrue(p.isInstantiated());
}
}
use of org.eclipse.core.expressions.EvaluationContext in project jbosstools-hibernate by jbosstools.
the class JPAMapToolActionDelegate method setEnabled.
public void setEnabled(Object context) {
if (context instanceof EvaluationContext) {
EvaluationContext ec = (EvaluationContext) context;
Object obj = ec.getDefaultVariable();
refContextObject = new WeakReference<Object>(obj);
} else if (context instanceof ExpressionContext) {
ExpressionContext ec = (ExpressionContext) context;
Object obj = ec.getDefaultVariable();
refContextObject = new WeakReference<Object>(obj);
} else {
refContextObject = null;
}
setBaseEnabled(checkEnabled());
}
Aggregations