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


Java CanExecute类代码示例

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


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

示例1: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(ESelectionService selectionService,
		@Optional @Named(PARAM_RESOURCE_TYPE) String resourceType) {
	Object s = selectionService.getSelection();
	if (resourceType == null) {
		return s != null && (s instanceof ECorpus || s instanceof EPipeline || s instanceof ETerminology);
	} else {
		if (resourceType.equals(EPipeline.class.getName()))
			return s != null && s instanceof EPipeline;
		else if (resourceType.equals(ECorpus.class.getName()))
			return s != null && s instanceof ECorpus;
		else if (resourceType.equals(ETerminology.class.getName()))
			return s != null && s instanceof ETerminology;
	}
	return false;
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:17,代码来源:RemoveResourceHandler.java

示例2: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(
		@Optional ParameterizedCommand command, 
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EPipeline selectedPipeline,
		ResourceService resourceService,
		NLPService extractorService) {
	if(command == null || command.getParameterMap().isEmpty()) {
		// try to run handler from selected EPipeline
		if(selectedPipeline != null)
			return extractorService.isPipelineValid(selectedPipeline);
		else 
			return false;
	} else {
		// try to run handler from parameterized command
		Map<String, Object> parameterMap = command.getParameterMap();
		Object pipelineName = parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID);
		return pipelineName != null
					&& resourceService.getPipeline(pipelineName.toString()).isPresent()
					&& extractorService.isPipelineValid(resourceService.getPipeline(pipelineName.toString()).get())
					;
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:23,代码来源:RunPipelineHandler.java

示例3: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
	
	// have active part injected via param
	
	// true if active part has a StructuredViewer
	Object o = activePart.getObject();
	StructuredViewerProvider part;
	// see if part has a StructuredViewer
	if (o instanceof StructuredViewerProvider)
	{
		return true;
	}
	
	return false;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:OpenObjectByListEntrySelectionFilterDialogHandler.java

示例4: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
	
	// have active part injected via param
	
	// true if active part has a StructuredViewer
	Object o = activePart.getObject();
	// see if part has a StructuredViewer
	if (o instanceof StructuredViewerProvider)
	{
		return true;
	}
	
	return false;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:OpenTypeSubtypeFilterDialogHandler.java

示例5: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
	
	// have active part injected via param
	
	// true if active part has a StructuredViewer
	Object o = activePart.getObject();
	CorpusNavigatorPart part;
	// see if part has a StructuredViewer
	if (o instanceof CorpusNavigatorPart)
	{
		return true;
	}
	
	return false;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:FilterOnlyInvalidTextsHandler.java

示例6: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
	
	// have active part injected via param
	
	// true if active part has a StructuredViewer
	Object o = activePart.getObject();
	LemmaNavigator part;
	// see if part has a StructuredViewer
	if (o instanceof LemmaNavigator)
	{
		return true;
	}
	
	return false;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:FilterOnlyInvalidLemmataHandler.java

示例7: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Optional ResourceProvider rp){
	
	if(rp == null){
		return false;
	}
	
	String id = rp.getID();
	if(CSToolResource.ANALYSER_INPUT.getID().equals(id)){
		return true;
	}
	if(CSToolResource.ANALYSER_CONF.getID().equals(id)){
		return true;
	}
	
	return false;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:18,代码来源:CreateAlternativeHandler.java

示例8: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Optional ResourceProvider rp){
	
	if(rp == null){
		return false;
	}
	
	String id = rp.getID();
	if(CSToolResource.EXTRACTOR_INPUT.getID().equals(id)){
		return true;
	}
	if(CSToolResource.EXTRACTOR_CONF.getID().equals(id)){
		return true;
	}
	
	return false;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:18,代码来源:CreateAlternativeHandler.java

示例9: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Optional IResource resource){
	
	if(resource instanceof IProject){
		IProject project = (IProject)resource;
		try {
			if(project.hasNature("org.eclipse.jdt.core.javanature")){
				return true;
			}
		} catch (CoreException e) {
			e.printStackTrace();
		}
	}
	
	return false;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:17,代码来源:ShowJavaProjectHandler.java

示例10: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Optional ResourceProvider rp){
	
	if(rp == null){
		return false;
	}
	
	String id = rp.getID();
	if(CSToolResource.SPOTTER_STA_INPUT.getID().equals(id)){
		return true;
	}
	if(CSToolResource.SPOTTER_STA_CONF.getID().equals(id)){
		return true;
	}
	
	return false;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:18,代码来源:CreateAlternativeHandler.java

示例11: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(ESelectionService selectionService){
	
	Object selection = selectionService.getSelection();
	
	if(selection instanceof Object[]){
		for(Object o : (Object[])selection){
			if(!canDelete(o)){
				return false;
			}
		}
	}
	else if(!canDelete(selection)){
		return false;
	}
	
	return true;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:19,代码来源:DeleteExplorerNodeHandler.java

示例12: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Optional ResourceProvider rp){
	
	if(rp == null){
		return false;
	}
	
	String id = rp.getID();
	if(CSToolResource.SPOTTER_DYN_INPUT.getID().equals(id)){
		return true;
	}
	if(CSToolResource.SPOTTER_DYN_CONF.getID().equals(id)){
		return true;
	}
	
	return false;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:18,代码来源:CreateAlternativeHandler.java

示例13: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) ISelection selection) {
	if (selection instanceof IStructuredSelection) {
		IStructuredSelection structured = (IStructuredSelection) selection;
		Object object = structured.getFirstElement();
		if (object instanceof IResource) {
			IResource resource = (IResource) object;
			if (extension.equals(resource.getFileExtension())) {
				selectedResource = resource;
				return true;
			}
		}
	}
	selectedResource = null;
	return false;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:18,代码来源:GenerateAvroHandler.java

示例14: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) ISelection selection) {
	if (selection instanceof IStructuredSelection) {
		IStructuredSelection structured = (IStructuredSelection) selection;
		Object object = structured.getFirstElement();
		if (object instanceof IResource) {
			IResource resource = (IResource) object;
			if (GENMODEL_EXTENSION.equals(resource.getFileExtension())) {
				selectedResource = resource;
				return true;
			}
		}
	}
	selectedResource = null;
	return false;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:18,代码来源:GenerateFromGenModelHandler.java

示例15: canExecute

import org.eclipse.e4.core.di.annotations.CanExecute; //导入依赖的package包/类
@CanExecute
public boolean canExecute(MPart part) {
	if(part != null && part.getObject() instanceof TreePart) {
		TreePath[] expandedTreePaths = ((TreePart) part.getObject()).getTreeViewer().getExpandedTreePaths();
		return expandedTreePaths.length > 0;			
	} else
		return false;
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:9,代码来源:CollapseAllHandler.java


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