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


Java IServiceConstants类代码示例

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


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

示例1: save

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Persist
public void save(MDirtyable dirty,
		@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
	String absolutePath = this.fileInput.getFile().getAbsolutePath();
	logger.debug("Saving " + absolutePath);

	try {
		fileInput.save(this.text.getText());
		
		// save was successful
		dirty.setDirty(false);
	} catch (IOException e) {
		logger.error(e);
		MessageDialog.openError(shell, "Save error", e.getMessage());
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:17,代码来源:FileEditorPart.java

示例2: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
		@Optional TerminologyService terminologyService,
		@Optional ETerminology terminology,
		@Optional IndexedCorpus indexedCorpus
		) throws IOException {
	
	FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
	fileDialog.setText("Exporting terminology "+ TerminologyPart.toPartLabel(terminology) +" to " + formatName);
	String path = fileDialog.open();
	if(path != null) {
		if(withOptionDialog) {
			Dialog dialog = getDialog(shell);
			if(dialog.open() == Dialog.OK) 
				export(shell, terminology, getExporter(dialog), indexedCorpus, path);
		} else
			// no option dialog
			export(shell, terminology, getExporter(), indexedCorpus, path);
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:22,代码来源:ExportHandler.java

示例3: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
		@Optional TerminologyService terminologyService,
		@Optional ETerminoViewerConfig viewerConfig,
		@Optional MPart terminologyPart
		) {
	EList<String> viewerList = viewerConfig.getSelectedPropertyNames();
	List<Property<?>> selectedProperties = viewerList
			.stream()
			.map(s -> PropertyUtil.forName(s)).collect(Collectors.toList());
	
	SelectPropertyDialog dialog = new SelectPropertyDialog(shell, selectedProperties, p-> true, false);
	if(dialog.open() == Dialog.OK) {
		List<String> propertyNames = dialog.getSelectedPropertyNames();
		viewerList.retainAll(propertyNames);
		propertyNames.removeAll(viewerList);
		viewerList.addAll(propertyNames);
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:21,代码来源:SelectTerminologyPropertiesHandler.java

示例4: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@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,代码行数:22,代码来源:RunPipelineHandler.java

示例5: canExecute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的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

示例6: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Execute
	public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,  E4PreferenceRegistry prefReg, 
			@Optional @Named("preferencePageId") String pageId)
	{
		PreferenceManager pm = prefReg.getPreferenceManager();
		PreferenceDialog dialog = new PreferenceDialog(shell, pm);
		if (pageId != null)
		{
			dialog.setSelectedNode(pageId);
		}

		dialog.create();
		dialog.getTreeViewer().setComparator(new ViewerComparator());
//		dialog.getTreeViewer().expandAll();
		dialog.open();
		
	}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:E4PreferencesHandler.java

示例7: receiveSelection

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Inject
@Optional
void receiveSelection(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection) {
	if (selection != null) {
		List<BTSObject> sel;
		if (selection instanceof List<?>) {
			sel = (List<BTSObject>)selection;
		} else {		
			sel = new Vector<BTSObject>();
			if (selection instanceof BTSObject[]) {
				sel.addAll(Arrays.asList((BTSObject[])selection));
			} else if (selection instanceof BTSObject)
				sel.add((BTSObject)selection);
		}
		appendToHistory(sel);
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:BTSSelectionHistoryServiceImpl.java

示例8: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
		EditingDomainController editingDomainController) {
	System.out.println("delete");
	if (selection instanceof EObject) {
		EditingDomain ed = null; // editingDomainController.getEditingDomain((EObject)
									// selection);
		if (ed != null) {
			Command command = SetCommand.create(ed, selection,
					BtsmodelPackage.ADMINISTRATIV_DATA_OBJECT__STATE,
					BTSConstants.OBJECT_STATE_TERMINATED);
			ed.getCommandStack().execute(command);

		}
else {
			((AdministrativDataObject) selection)
					.setState(BTSConstants.OBJECT_STATE_TERMINATED);
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:DeleteHandler.java

示例9: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
		BTSConfigurationController configurationController, EventBroker eventBroker,
		IEclipseContext context)
{

	NewConfigurationDialog dialog = new NewConfigurationDialog(shell);
	ContextInjectionFactory.inject(
			dialog, context);
	if (dialog.open() == dialog.OK)
	{
		System.out.println("Realm.runWithDefault in NewConfigurationHandler");
		final BTSConfiguration config = dialog.getConfiguration();
		configurationController.save(config);
		eventBroker.post("model_new/asyncEvent", config);
	}

}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:NewConfigurationHandler.java

示例10: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Optional
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
		IEclipseContext context,
		@Optional @Named("org.bbaw.bts.ui.main.commandparameter.dbManagerMessage") String message) {
	IEclipseContext child = context.createChild("DBManager");
	child.set("dbManagerMessage", message);
	if (shell == null)
	{
		child.set(Shell.class, new Shell());
	}
	else
	{
		child.set(Shell.class, shell);
	}
	DBManagerDialog dialog = ContextInjectionFactory.make(
			DBManagerDialog.class, child);
	// context.set(UserManagementDialog.class, dialog);

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

示例11: setSelection

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Inject
public void setSelection(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) BTSObject selection) {
	if (selection == null) {
		/* implementation not shown */
	} else {
		if (selection instanceof BTSCorpusObject) { // concerned by selection
			if (selection != null && !selection.equals(corpusObject)) {
				
				if (constructed)
				{
					if (loaded && save_on_deselection && corpusObject != null)
					{
						save();
					}
					corpusObject = (BTSCorpusObject) selection;
					if (parent != null && !parent.isDisposed())
					{
						delayedSetSeletction((BTSCorpusObject) selection);
					}
				}

			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:27,代码来源:PassportEditorPart.java

示例12: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@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,代码行数:26,代码来源:CheckPassportCompletenessHandler.java

示例13: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
		EditingDomainController editingDomainController,
		CorpusCommandController commandController, @Optional @Active MPart activePart) {
	System.out.println("restore");
	if (selection instanceof EObject) {
		((AdministrativDataObject) selection)
				.setState(BTSConstants.OBJECT_STATE_ACTIVE);
		// General Command Controller... save!
		commandController.save((BTSDBBaseObject) selection);
		if (activePart != null)
		{
		
			Object o = activePart.getObject();
			if (o instanceof StructuredViewerProvider)
			{
				StructuredViewerProvider viewerProvider = (StructuredViewerProvider) o;
				viewerProvider.getActiveStructuredViewer().refresh();
			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:24,代码来源:RestoreDeletedHandler.java

示例14: execute

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
		CorpusCommandController commandController, @Optional @Active MPart activePart,
		final Shell shell) {
	if (selection instanceof BTSDBBaseObject) {
		if (MessageDialog.openConfirm(shell,
				"Confirm deletion",
				"Object will not be recoverable after deletion. Proceed?")) {
			commandController.deleteFromDB((BTSDBBaseObject) selection);
			if (activePart != null)
			{
				Object o = activePart.getObject();
				if (o instanceof StructuredViewerProvider)
				{
					StructuredViewerProvider viewerProvider = (StructuredViewerProvider) o;
					viewerProvider.getActiveStructuredViewer().refresh();
				}
			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:DeletePermanentlyHandler.java

示例15: setSelection

import org.eclipse.e4.ui.services.IServiceConstants; //导入依赖的package包/类
@Inject
void setSelection(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection) {
	if (selection != null && !selection.equals(this.selection)
			&& selection instanceof EObject) {
		EditingDomain ed = null;
		if (this.selection != null && this.selection instanceof EObject) {
			ed = getEditingDomain((EObject) this.selection);
			if (ed != null) {
				ed.getCommandStack().removeCommandStackListener(
						getCommandStackListener());
			}
		}
		this.selection = selection;
		evaluateUndoRedo();
		ed = getEditingDomain((EObject) selection);
		if (ed != null) {
			ed.getCommandStack().addCommandStackListener(
					getCommandStackListener());
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:EditingDomainControllerImpl.java


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