本文整理汇总了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;
}
示例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())
;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}