当前位置: 首页>>代码示例>>Java>>正文


Java EvaluationResult类代码示例

本文整理汇总了Java中org.eclipse.core.expressions.EvaluationResult的典型用法代码示例。如果您正苦于以下问题:Java EvaluationResult类的具体用法?Java EvaluationResult怎么用?Java EvaluationResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EvaluationResult类属于org.eclipse.core.expressions包,在下文中一共展示了EvaluationResult类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
public boolean test(Object receiver, String property, Object[] args,
    Object expectedValue) {
  String delegateShortcutID = (String) args[0];
  Expression expr = expressions.get(delegateShortcutID);
  if (expr == null) {
    expr = createEnablementExpression(delegateShortcutID);
    expressions.put(delegateShortcutID, expr);
  }
  try {
    return expr.evaluate(createContext(receiver)) != EvaluationResult.FALSE;
  } catch (CoreException ce) {
    EclEmmaUIPlugin.getInstance().getLog()
        .log(EclEmmaUIPlugin.errorStatus("Launch shortcut '" //$NON-NLS-1$
            + delegateShortcutID
            + "' enablement expression caused exception.", //$NON-NLS-1$
            ce));
    return false;
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:20,代码来源:ContextualLaunchableTester.java

示例2: createContributionItems

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
	IMenuService menuService = (IMenuService) serviceLocator.getService(IMenuService.class);
	if (menuService == null) {
		CloudFoundryPlugin
				.logError("Unable to retrieve Eclipse menu service. Cannot add Cloud Foundry context menus."); //$NON-NLS-1$
		return;
	}

	List<IAction> debugActions = getActions(menuService);
	for (IAction action : debugActions) {
		additions.addContributionItem(new ActionContributionItem(action), new Expression() {
			public EvaluationResult evaluate(IEvaluationContext context) {
				return EvaluationResult.TRUE;
			}

			public void collectExpressionInfo(ExpressionInfo info) {
			}
		});
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:22,代码来源:AbstractMenuContributionFactory.java

示例3: createContributionItems

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
	IMenuService menuService = (IMenuService) serviceLocator.getService(IMenuService.class);
	if (menuService == null) {
		DockerFoundryPlugin
				.logError("Unable to retrieve Eclipse menu service. Cannot add Cloud Foundry context menus."); //$NON-NLS-1$
		return;
	}

	List<IAction> debugActions = getActions(menuService);
	for (IAction action : debugActions) {
		additions.addContributionItem(new ActionContributionItem(action), new Expression() {
			public EvaluationResult evaluate(IEvaluationContext context) {
				return EvaluationResult.TRUE;
			}

			public void collectExpressionInfo(ExpressionInfo info) {
			}
		});
	}
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:22,代码来源:AbstractMenuContributionFactory.java

示例4: createContributionItems

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator,
		IContributionRoot additions) {
	CommandContributionItemParameter toggleWatchpointParam = new CommandContributionItemParameter(serviceLocator, null, "org.eclipse.debug.ui.commands.ToggleWatchpoint", CommandContributionItem.STYLE_PUSH);
	toggleWatchpointParam.icon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT);
	toggleWatchpointParam.disabledIcon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED);
	toggleWatchpointParam.label = "Add Watchpoint";
	CommandContributionItem toggleWatchpoint = new CommandContributionItem(toggleWatchpointParam);
	Expression toggleWatchpointVisible = new Expression() {
		
		@Override
		public EvaluationResult evaluate(IEvaluationContext context)
				throws CoreException {
			return EvaluationResult.valueOf((context.getVariable("activeEditor") instanceof BfEditor));
		}
	};
	additions.addContributionItem(toggleWatchpoint, toggleWatchpointVisible);
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:19,代码来源:WatchpointExtensionFactory.java

示例5: matches

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:CompletionProposalCategory.java

示例6: matches

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
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,代码行数:23,代码来源:ClasspathFixProcessorDescriptor.java

示例7: createEditPart

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:24,代码来源:EditpartExtensionManager.java

示例8: setEnabled

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
@Override
public void setEnabled(Object evaluationContext) {
	if (evaluationContext instanceof IEvaluationContext) {
		try {
			setEnabled(getEnabledWhenExpression().evaluate(
					(IEvaluationContext)evaluationContext)==EvaluationResult.TRUE);
		} catch (CoreException e) {
			//ignore
		}
	}
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:12,代码来源:CleanupChangesCommand.java

示例9: isEnabledFor

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
/**
 * Returns true if hover is enabled for current contentType/context
 * @param contentType
 * @param context
 * @return
 */
public boolean isEnabledFor(QualifiedContentType contentType, IEvaluationContext context) {
	if (!handlesContentType(contentType)) {
		return false;
	}
	if (enablementExpression != null) {
		try {
			return enablementExpression.evaluate(context) != EvaluationResult.FALSE;
		} catch (CoreException e) {
			IdeLog.logError(CommonEditorPlugin.getDefault(), e);
			return false;
		}
	}
	return true;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:TextHoverDescriptor.java

示例10: matches

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
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,代码行数:33,代码来源:ContributedProcessorDescriptor.java

示例11: isEnabled

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
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);
}
 
开发者ID:eclipse,项目名称:thym,代码行数:8,代码来源:PlatformSupport.java

示例12: evaluate

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
@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;
}
 
开发者ID:wangzw,项目名称:CppStyle,代码行数:31,代码来源:CppStyleHandler.java

示例13: getAdapterList

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:35,代码来源:ElementAdapterManager.java

示例14: convert

import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
private boolean convert(EvaluationResult eval) {
  if (eval == EvaluationResult.FALSE) return false;
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:ParticipantDescriptor.java


注:本文中的org.eclipse.core.expressions.EvaluationResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。