Java Code Examples for org.eclipse.core.expressions.Expression#evaluate()
The following examples show how to use
org.eclipse.core.expressions.Expression#evaluate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClasspathFixProcessorDescriptor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public boolean matches(IJavaProject javaProject) { if (fStatus != null) { return fStatus.booleanValue(); } IConfigurationElement[] children= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT); if (children.length == 1) { try { ExpressionConverter parser= ExpressionConverter.getDefault(); Expression expression= parser.perform(children[0]); EvaluationContext evalContext= new EvaluationContext(null, javaProject); evalContext.addVariable("project", javaProject); //$NON-NLS-1$ evalContext.addVariable("sourceLevel", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); //$NON-NLS-1$ return expression.evaluate(evalContext) == EvaluationResult.TRUE; } catch (CoreException e) { JavaPlugin.log(e); } return false; } fStatus= Boolean.FALSE; return false; }
Example 2
Source File: EditpartExtensionManager.java From birt with Eclipse Public License 1.0 | 6 votes |
public static EditPart createEditPart( EditPart context, Object model ) { EvaluationContext econtext = new EvaluationContext( null, model ); for ( Iterator<Expression> iterator = extensionMap.keySet( ).iterator( ); iterator.hasNext( ); ) { try { Expression expression = iterator.next( ); if ( expression.evaluate( econtext ) == EvaluationResult.TRUE ) { EditPart editPart = (EditPart) extensionMap.get( expression ) .createExecutableExtension( "type" ); //$NON-NLS-1$ editPart.setModel( model ); return editPart; } } catch ( CoreException e ) { logger.log( Level.SEVERE, e.getMessage( ), e ); } } return null; }
Example 3
Source File: ContributedProcessorDescriptor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private boolean matches(ICompilationUnit cunit) { if (fRequiredSourceLevel != null) { String current= cunit.getJavaProject().getOption(JavaCore.COMPILER_SOURCE, true); if (JavaModelUtil.isVersionLessThan(current, fRequiredSourceLevel)) { return false; } } if (fStatus != null) { return fStatus.booleanValue(); } IConfigurationElement[] children= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT); if (children.length == 1) { try { ExpressionConverter parser= ExpressionConverter.getDefault(); Expression expression= parser.perform(children[0]); EvaluationContext evalContext= new EvaluationContext(null, cunit); evalContext.addVariable("compilationUnit", cunit); //$NON-NLS-1$ IJavaProject javaProject= cunit.getJavaProject(); String[] natures= javaProject.getProject().getDescription().getNatureIds(); evalContext.addVariable("projectNatures", Arrays.asList(natures)); //$NON-NLS-1$ evalContext.addVariable("sourceLevel", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); //$NON-NLS-1$ return expression.evaluate(evalContext) == EvaluationResult.TRUE; } catch (CoreException e) { JavaPlugin.log(e); } return false; } fStatus= Boolean.FALSE; return false; }