本文整理汇总了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;
}
}
示例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) {
}
});
}
}
示例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) {
}
});
}
}
示例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);
}
示例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;
}
示例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;
}
示例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
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例14: convert
import org.eclipse.core.expressions.EvaluationResult; //导入依赖的package包/类
private boolean convert(EvaluationResult eval) {
if (eval == EvaluationResult.FALSE) return false;
return true;
}