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


Java EvaluationContext类代码示例

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


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

示例1: testCopyUrl

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
@Test
public void testCopyUrl() throws ExecutionException {
	// Given
	String url = "https://github.com/cchabanois/mesfavoris";
	Bookmark bookmark = new Bookmark(new BookmarkId(),
			ImmutableMap.of(UrlBookmarkProperties.PROP_URL, url));
	IEvaluationContext context = new EvaluationContext(null, new Object());
	context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, new StructuredSelection(bookmark));
	ExecutionEvent event = new ExecutionEvent(null, new HashMap<>(), null, context);

	// When
	CopyBookmarkUrlHandler handler = new CopyBookmarkUrlHandler();
	executeHandler(handler, event);

	// Then
	assertEquals(url, getClipboardContents());
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:18,代码来源:CopyBookmarkUrlHandlerTest.java

示例2: getServerModule

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
protected IServerModule getServerModule(Object context) {
	Object toCheck = context;

	if (toCheck instanceof EvaluationContext) {
		toCheck = ((EvaluationContext) toCheck).getDefaultVariable();
	}

	if (toCheck instanceof List<?>) {
		List<?> content = (List<?>) toCheck;
		if (!content.isEmpty()) {
			Object obj = content.get(0);
			if (obj instanceof IServerModule) {
				return (IServerModule) obj;
			}
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:19,代码来源:CloudFoundryPropertyTester.java

示例3: matches

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的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

示例4: matches

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的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

示例5: createEditPart

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的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

示例6: createEvaluationContext

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
private static EvaluationContext createEvaluationContext(
    RefactoringProcessor processor, Object element, String[] affectedNatures) {
  EvaluationContext result = new EvaluationContext(null, element);
  result.setAllowPluginActivation(true);
  result.addVariable("element", element); // $NON-NLS-1$
  result.addVariable("affectedNatures", Arrays.asList(affectedNatures)); // $NON-NLS-1$
  result.addVariable("processorIdentifier", processor.getIdentifier()); // $NON-NLS-1$
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:ParticipantExtensionPoint.java

示例7: createEvaluationContext

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
private IEvaluationContext createEvaluationContext( ISelection selection ) {
  IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
  IEvaluationContext result = new EvaluationContext( null, new Object() );
  result.addVariable( ISources.ACTIVE_WORKBENCH_WINDOW_NAME, activeWorkbenchWindow );
  result.addVariable( ISources.ACTIVE_CURRENT_SELECTION_NAME, selection );
  return result;
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:8,代码来源:OpenWithQuickMenuHandlerPDETest.java

示例8: createEvaluationContext

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
private IEvaluationContext createEvaluationContext( Object editorInput ) {
  IWorkbenchWindow activeWorkbenchWindow = workbenchPage.getWorkbenchWindow();
  IEvaluationContext result = new EvaluationContext( null, new Object() );
  result.addVariable( ISources.ACTIVE_WORKBENCH_WINDOW_NAME, activeWorkbenchWindow );
  if( editorInput != null ) {
    result.addVariable( ISources.ACTIVE_EDITOR_INPUT_NAME, editorInput );
  }
  return result;
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:10,代码来源:DeleteEditorFileHandler_ResourcePDETest.java

示例9: createEvaluationContext

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
private IEvaluationContext createEvaluationContext( IWorkbenchPart activePart ) {
  IWorkbenchWindow activeWorkbenchWindow = workbenchPage.getWorkbenchWindow();
  IEvaluationContext result = new EvaluationContext( null, new Object() );
  result.addVariable( ISources.ACTIVE_WORKBENCH_WINDOW_NAME, activeWorkbenchWindow );
  if( activePart != null ) {
    result.addVariable( ISources.ACTIVE_PART_NAME, activePart );
  }
  return result;
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:10,代码来源:CloseViewHandlerPDETest.java

示例10: getEnabledTextHoverDescriptors

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
private List<TextHoverDescriptor> getEnabledTextHoverDescriptors(ITextViewer textViewer, int offset)
{
	List<TextHoverDescriptor> result = new ArrayList<TextHoverDescriptor>();
	if (fTextEditor == null)
	{
		return result;
	}
	try
	{
		QualifiedContentType contentType = CommonEditorPlugin.getDefault().getDocumentScopeManager()
				.getContentType(textViewer.getDocument(), offset);
		IEvaluationContext context = new EvaluationContext(null, textViewer);
		IWorkbenchPartSite site = fTextEditor.getSite();
		if (site != null)
		{
			context.addVariable(ISources.ACTIVE_EDITOR_ID_NAME, site.getId());
		}
		for (TextHoverDescriptor descriptor : TextHoverDescriptor.getContributedHovers())
		{
			if (descriptor.isEnabledFor(contentType, context))
			{
				result.add(descriptor);
			}
		}
	}
	catch (BadLocationException e)
	{
	}
	return result;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:31,代码来源:CommonSourceViewerConfiguration.java

示例11: matches

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的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

示例12: getAdapterList

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的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

示例13: createContext

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
private IEvaluationContext createContext(Object selection) {
  IEvaluationContext context = new EvaluationContext(null, selection);
  context.addVariable("selection", selection); //$NON-NLS-1$
  return context;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:6,代码来源:ContextualLaunchableTester.java

示例14: createEvaluationContext

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
private IEvaluationContext createEvaluationContext() {
  IEvaluationContext result = new EvaluationContext( null, new Object() );
  result.addVariable( ACTIVE_WORKBENCH_WINDOW_NAME, workbenchWindow );
  return result;
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:6,代码来源:OpenLaunchDialogHanderPDETest.java

示例15: openFilterDialog

import org.eclipse.core.expressions.EvaluationContext; //导入依赖的package包/类
void openFilterDialog() {
	final IEvaluationContext ec = new EvaluationContext(null, this);
	ec.addVariable(ISources.ACTIVE_PART_NAME, this);
	final ExecutionEvent ev = new ExecutionEvent(null, new HashMap<>(), this, ec);
	new ConfigureContentsDialogHandler().execute(ev);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:7,代码来源:SyntaxErrorsView.java


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