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


Java IServiceConstants.ACTIVE_SELECTION属性代码示例

本文整理汇总了Java中org.eclipse.e4.ui.services.IServiceConstants.ACTIVE_SELECTION属性的典型用法代码示例。如果您正苦于以下问题:Java IServiceConstants.ACTIVE_SELECTION属性的具体用法?Java IServiceConstants.ACTIVE_SELECTION怎么用?Java IServiceConstants.ACTIVE_SELECTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.e4.ui.services.IServiceConstants的用法示例。


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

示例1: execute

@Execute
public void execute(ParameterizedCommand command, 
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EPipeline selectedPipeline,
		@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
		NLPService extractorService,
		ResourceService resourceService) {
	Map<String, Object> parameterMap = command.getParameterMap();
	boolean useCache = parameterMap.containsKey(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_USE_CACHE)
			&& Boolean.parseBoolean((String) parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_USE_CACHE));
	if(!parameterMap.containsKey(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID)
			&& selectedPipeline != null) {
		// run handler from selected pipeline
		runPipeline(shell, extractorService, resourceService, selectedPipeline, useCache);
	} else {
		// run handler from parameterized command
		String pipelineName = parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID).toString();
		java.util.Optional<EPipeline> pipeline = resourceService.getPipeline(pipelineName);
		if(pipeline.isPresent()) 
			runPipeline(shell, extractorService, resourceService, pipeline.get(), useCache);
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:21,代码来源:RunPipelineHandler.java

示例2: canExecute

@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,代码行数:22,代码来源:RunPipelineHandler.java

示例3: execute

@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional Object object,
		@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
		IEclipseContext context) {
	BTSCorpusObject corpusObject = null;
	if (object instanceof BTSCorpusObject)
	{
		corpusObject = (BTSCorpusObject) object;
	}
	else if (object instanceof BTSTextSelectionEvent && ((BTSTextSelectionEvent) object).data instanceof BTSCorpusObject)
	{
		corpusObject = (BTSCorpusObject) ((BTSTextSelectionEvent) object).data;
	}
	if (corpusObject == null) return;
	IEclipseContext child = context.createChild();
	child.set(BTSCorpusObject.class, corpusObject);
	child.set(Shell.class, shell);
	
	CheckPassportDialog dialog = ContextInjectionFactory.make(
			CheckPassportDialog.class, child);

	if (dialog.open() == CheckPassportDialog.OK) {
		
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:25,代码来源:CheckPassportCompletenessHandler.java

示例4: updateOccurrences

@Inject
void updateOccurrences(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object object) {
	Collection<TermOccurrence> occurrences = null;
	if(viewer != null && object != null) {
		if(object instanceof TermOccurrenceContainer) {
			occurrences = ((TermOccurrenceContainer<?>)object).getOccurrences();
		} else if (object instanceof TermService) {
			occurrences = ((TermService)object).getOccurrences();
		} else if (object instanceof RelationService) {
			RelationService sv = (RelationService)object;
			occurrences = sv.getTo().getOccurrences();
		} else
			return;
		documentContainers = TermOccurrenceUtil.toDocumentContainers(occurrences, corpusService);
		occurrencesList = Lists.newArrayList();
		documentContainersMap = Maps.newLinkedHashMap();
		for(TermOccurrenceContainer<EDocument> c:documentContainers) 
			for(TermOccurrence o:c.getOccurrences()) {
				this.documentContainersMap.put(o, c);
				this.occurrencesList.add(o);
			}
		Collections.sort(documentContainers, new Comparator<TermOccurrenceContainer<EDocument>>() {
				@Override
				public int compare(TermOccurrenceContainer<EDocument> e1, TermOccurrenceContainer<EDocument> e2) {
					return TermSuiteUI.DOCUMENT_COMPARATOR.compare(
							e1.getContainer(), 
							e2.getContainer());
				}
		});
		viewer.setInput(documentContainers);
		viewer.collapseAll();
		if(!documentContainers.isEmpty() && !documentContainers.get(0).getOccurrences().isEmpty()) {
			viewer.setExpandedState(documentContainers.get(0), true);
			viewer.getTree().setTopItem(viewer.getTree().getItem(0));
		}
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:37,代码来源:OccurrencePart.java

示例5: execute

@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EObject selectedObject,
		@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
		ResourceService resourceService,
		NLPService extractorService,
		CorpusService corpusService) {
	RenameDialog dialog = new RenameDialog(shell, resourceService, selectedObject);
	if(dialog.open() == Window.OK) 
		resourceService.rename(selectedObject, dialog.getNewName());
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:11,代码来源:RenameHandler.java

示例6: canExecute

@CanExecute
public boolean canExecute(
		ResourceService resourceService,
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EObject selectedObject) {
	return selectedObject != null && (
			resourceService.isRenameable(selectedObject.getClass()));
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:7,代码来源:RenameHandler.java

示例7: canExecute

@CanExecute
public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
		@Optional @Named(BTSCoreConstants.CORE_EXPRESSION_MAY_EDIT) Boolean mayEdit) {
	if (mayEdit != null && mayEdit.booleanValue() && selection instanceof BTSDBBaseObject)
	{
		if (!((BTSDBBaseObject)selection).getConflictingRevs().isEmpty())
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:OpenConflictsDialog.java

示例8: execute

@Execute
public void execute(
		@Named(IServiceConstants.ACTIVE_SELECTION) @Optional BTSTextSelectionEvent event,
		@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
		EventBroker eventBroker,
		BTSTextEditorController textController) {
		BTSObject dbbaseObject = (BTSObject) event.data;
	
		if (dbbaseObject != null)
		{
			final BTSText object = textController
					.createNewText((BTSCorpusObject) dbbaseObject);
			object.setType(BTSConstants.ANNOTATION_SUBTEXT);
			BTSRelation rel = null;
			if (object.getRelations().isEmpty())
			{
				rel = BtsmodelFactory.eINSTANCE.createBTSRelation();
			}
			else
			{
				rel = object.getRelations().get(0);
			}

			rel.setObjectId(dbbaseObject.get_id());
			object.getRelations().add(rel);
			BTSInterTextReference ref = BtsmodelFactory.eINSTANCE.createBTSInterTextReference();
			ref.setBeginId(event.getStartId());
			ref.setEndId(event.getEndId());
			rel.getParts().add(ref);
			textController.save(object);
		}
		// FIXME eventBroker.post("model_add/BTSAnnotation", object);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:33,代码来源:AddGlosseHandler.java

示例9: execute

@Execute
public void execute(CorpusNavigatorController corpusNavigatorController, EventBroker eventBroker, 
		@Named(IServiceConstants.ACTIVE_SELECTION) @Optional BTSCorpusObject selection)
{
	BTSTCObject object = corpusNavigatorController.createNewTCObject(selection);
	object.setName("Object1");
	eventBroker.post("model_new/asyncEvent", object);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:8,代码来源:CreateNewTCObjectHandler.java

示例10: canExecute

@CanExecute
public boolean canExecute(
		@Named(IServiceConstants.ACTIVE_SELECTION) @Optional BTSCorpusObject selection) {
	if (!(selection instanceof BTSAnnotation)) {
		if ((latestSelection == null) || !selection.get_id().equals(latestSelection.get_id())) {
			String dbCollectionName = navigatorController.getDBCollectionName(selection);
			latestStatus = permissionController.authenticatedUserMayAddToDBCollection(dbCollectionName);
			latestSelection = selection;
		}
		return latestStatus;
	}
	return false;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:AddNewTCObjectHandler.java

示例11: execute

@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional BTSCorpusObject selection,
		@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell, EventBroker eventBroker,
		CorpusNavigatorController corpusNavigatorController)
{
	latestSelection = selection;

	final BTSText object = corpusNavigatorController.createNewText(selection);

	corpusNavigatorController.save(object);
	eventBroker.post("model_new/BTSText", object);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:AddNewTextHandler.java

示例12: setSelection

@Inject
void setSelection(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) BTSObject selection) {
	if (selection == null) {
		/* implementation not shown */
	} else {
		if (!(selection instanceof BTSAbstractText)) {
			if (loaded)
			{
				mainTreeViewer.setSelection(null);
			}
		}
		System.out.println("CorpusNavigator selection received");
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:15,代码来源:ATextNavigatorPart.java

示例13: canExecute

@CanExecute
public boolean canExecute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) BTSDBBaseObject selection,
		@Optional @Named(BTSCoreConstants.CORE_EXPRESSION_MAY_DELETE) Boolean mayDelete) {
	if (mayDelete != null && mayDelete.booleanValue())
	{
		if (selection != null && selection instanceof AdministrativDataObject) {
			return !((AdministrativDataObject)selection).getState().equals(BTSConstants.OBJECT_STATE_TERMINATED);
		}
	}
	return false;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:DeleteHandler.java

示例14: setSelection

@Inject
void setSelection(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) BTSObject selection) {
	if (selection == null) {
		/* implementation not shown */
	} else {
		if (!(selection instanceof BTSCorpusObject)) {
			if (loaded)
			{
				mainTreeViewer.setSelection(null);
			}
		}
		System.out.println("CorpusNavigator selection received");
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:15,代码来源:CorpusNavigatorPart.java

示例15: execute

@Execute
public void execute(
		@Named(IServiceConstants.ACTIVE_SELECTION) @Optional BTSTextSelectionEvent event,
		@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
		EventBroker eventBroker,
		CorpusNavigatorController corpusNavigatorController) {
		BTSObject dbbaseObject = (BTSObject) event.data;
	
		if (dbbaseObject != null)
		{
			final BTSAnnotation object = corpusNavigatorController
					.createNewAnnotation((BTSCorpusObject) dbbaseObject, BTSConstants.ANNOTATION +
							CorpusUtils.TYPE_PATH_DELIMITER + CorpusUtils.ANNOTATION_RUBRUM_TYPE);
			object.setName("Rubrum");
			BTSRelation rel = null;
			if (object.getRelations().isEmpty())
			{
				rel = BtsmodelFactory.eINSTANCE.createBTSRelation();
				object.getRelations().add(rel);
			}
			else
			{
				rel = object.getRelations().get(0);
			}

			rel.setObjectId(dbbaseObject.get_id());
			
			BTSInterTextReference ref = BtsmodelFactory.eINSTANCE.createBTSInterTextReference();
			ref.setBeginId(event.getStartId());
			ref.setEndId(event.getEndId());
			rel.getParts().add(ref);
			corpusNavigatorController.save(object);
		}
		// FIXME eventBroker.post("model_add/BTSAnnotation", object);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:35,代码来源:AddRubrumHandler.java


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