本文整理汇总了Java中org.eclipse.core.expressions.EvaluationResult.TRUE属性的典型用法代码示例。如果您正苦于以下问题:Java EvaluationResult.TRUE属性的具体用法?Java EvaluationResult.TRUE怎么用?Java EvaluationResult.TRUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.expressions.EvaluationResult
的用法示例。
在下文中一共展示了EvaluationResult.TRUE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matches
/**
* Determines if the project matches any enablement expression defined on the extension.
*
* @param javaProject the Java project against which to test the enablement expression, can be
* <code>null</code>
* @return <code>true</code> if any enablement expression matches the given project or if the
* project is <code>null</code> or no enablement expression is specified,
* <code>false</code> otherwise
* @since 3.8
*/
public boolean matches(IJavaProject javaProject) {
if (fEnablementExpression == null) {
return true;
}
if (javaProject == null) {
return false;
}
try {
EvaluationContext evalContext= new EvaluationContext(null, javaProject);
evalContext.addVariable("project", javaProject); //$NON-NLS-1$
return fEnablementExpression.evaluate(evalContext) == EvaluationResult.TRUE;
} catch (CoreException e) {
JavaPlugin.log(e);
}
return false;
}
示例2: matches
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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:ClasspathFixProcessorDescriptor.java
示例3: createEditPart
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;
}
示例4: matches
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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:ContributedProcessorDescriptor.java
示例5: isEnabled
public boolean isEnabled(IEvaluationContext context) throws CoreException{
if(expression == null ) return true;
if(context == null ){
throw new IllegalArgumentException("Must have an evalutation context");
}
return (this.expression.evaluate(context) == EvaluationResult.TRUE);
}
示例6: evaluate
@Override
protected EvaluationResult evaluate(IEvaluationContext context) {
IWorkbenchWindow window = InternalHandlerUtil.getActiveWorkbenchWindow(context);
// no window? not active
if (window == null)
return EvaluationResult.FALSE;
WorkbenchPage page = (WorkbenchPage) window.getActivePage();
// no page? not active
if (page == null)
return EvaluationResult.FALSE;
// get saveable part
ISaveablePart saveablePart = getSaveablePart(context);
if (saveablePart == null)
return EvaluationResult.FALSE;
if (saveablePart instanceof ISaveablesSource) {
ISaveablesSource modelSource = (ISaveablesSource) saveablePart;
if (SaveableHelper.needsSave(modelSource))
return EvaluationResult.TRUE;
return EvaluationResult.FALSE;
}
if (saveablePart != null && saveablePart.isDirty())
return EvaluationResult.TRUE;
return EvaluationResult.FALSE;
}
示例7: getAdapterList
private static List getAdapterList( Object adaptableObject,
Class adatperType )
{
Set adapters = getAdapters( adaptableObject );
if ( adapters == null )
return null;
List adapterObjects = new ArrayList( );
l: for ( Iterator iter = adapters.iterator( ); iter.hasNext( ); )
{
ElementAdapter adapter = (ElementAdapter) iter.next( );
if ( adapter.getExpression( ) != null )
{
EvaluationContext context = new EvaluationContext( null,
adaptableObject );
context.setAllowPluginActivation( true );
try
{
if ( adapter.getExpression( ).evaluate( context ) != EvaluationResult.TRUE )
continue l;
}
catch ( CoreException e )
{
}
}
Object obj = adapter.getAdater( adaptableObject );
if ( obj != null && adatperType.isAssignableFrom( obj.getClass( ) ) )
{
adapterObjects.add( obj );
}
}
return adapterObjects;
}