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


Java IHandlerActivation类代码示例

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


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

示例1: addAction

import org.eclipse.ui.handlers.IHandlerActivation; //导入依赖的package包/类
@Override
public void addAction(final IAction action) {
    Check.notNull(action, "action"); //$NON-NLS-1$

    final String commandId = action.getActionDefinitionId();

    if (commandId == null) {
        throw new IllegalArgumentException("action does not have an action definition ID set"); //$NON-NLS-1$
    }

    final TriggerSequence[] bindings = bindingService.getActiveBindingsFor(commandId);

    if (bindings.length > 0) {
        final IHandler handler = new ActionHandler(action);
        /*
         * Call this deprecated overload for 3.1 support
         */
        final IHandlerActivation activation =
            handlerService.activateHandler(commandId, handler, expression, sourcePriorities);
        handlerActivations.add(activation);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:ModernActionKeyBindingSupport.java

示例2: registerCommands

import org.eclipse.ui.handlers.IHandlerActivation; //导入依赖的package包/类
public void registerCommands(CompilationUnitEditor editor) {
	IWorkbench workbench= PlatformUI.getWorkbench();
	ICommandService commandService= (ICommandService) workbench.getAdapter(ICommandService.class);
	IHandlerService handlerService= (IHandlerService) workbench.getAdapter(IHandlerService.class);
	if (commandService == null || handlerService == null) {
		return;
	}

	if (fCorrectionHandlerActivations != null) {
		JavaPlugin.logErrorMessage("correction handler activations not released"); //$NON-NLS-1$
	}
	fCorrectionHandlerActivations= new ArrayList<IHandlerActivation>();

	Collection<String> definedCommandIds= commandService.getDefinedCommandIds();
	for (Iterator<String> iter= definedCommandIds.iterator(); iter.hasNext();) {
		String id= iter.next();
		if (id.startsWith(ICommandAccess.COMMAND_ID_PREFIX)) {
			boolean isAssist= id.endsWith(ICommandAccess.ASSIST_SUFFIX);
			CorrectionCommandHandler handler= new CorrectionCommandHandler(editor, id, isAssist);
			IHandlerActivation activation= handlerService.activateHandler(id, handler, new LegacyHandlerSubmissionExpression(null, null, editor.getSite()));
			fCorrectionHandlerActivations.add(activation);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:CorrectionCommandInstaller.java

示例3: activateTerminateHandler

import org.eclipse.ui.handlers.IHandlerActivation; //导入依赖的package包/类
private void activateTerminateHandler(final IProgressMonitor monitor, final WorkspaceJob job) {
	final IHandlerService handlerService = (IHandlerService) window
			.getService(IHandlerService.class);
	window.getShell().getDisplay().syncExec(new Runnable() {
		@Override
		public void run() {
			final IHandlerActivation activation = handlerService.activateHandler(TERMINATE_ID,
					new TerminateHandler(monitor));
			job.addJobChangeListener(new JobChangeAdapter() {
				@Override
				public void done(IJobChangeEvent event) {
					window.getShell().getDisplay().syncExec(new Runnable() {
						@Override
						public void run() {
							handlerService.deactivateHandler(activation);
						}
					});
				}
			});
		}
	});
}
 
开发者ID:agacek,项目名称:jkind-xtext,代码行数:23,代码来源:RunJRealizabilityHandler.java

示例4: dispose

import org.eclipse.ui.handlers.IHandlerActivation; //导入依赖的package包/类
@Override
public void dispose() {
    for (final Iterator it = handlerActivations.iterator(); it.hasNext();) {
        final IHandlerActivation activation = (IHandlerActivation) it.next();
        handlerService.deactivateHandler(activation);
        activation.getHandler().dispose();
    }
    handlerActivations.clear();
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:10,代码来源:ModernActionKeyBindingSupport.java

示例5: dispose

import org.eclipse.ui.handlers.IHandlerActivation; //导入依赖的package包/类
@Override
public final void dispose() {
	doDispose();
	
	for (IHandlerActivation handlerActivation : handlerActivations) {
		getHandlerService_2().deactivateHandler(handlerActivation);
	}
	
	super.dispose();
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:11,代码来源:LangEditorActionContributor.java

示例6: activateHandler

import org.eclipse.ui.handlers.IHandlerActivation; //导入依赖的package包/类
protected void activateHandler(String string, AbstractHandler handler) {
	IHandlerActivation handlerActivation = getHandlerService_2().activateHandler(string, handler);
	handlerActivations.add(handlerActivation);
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:5,代码来源:LangEditorActionContributor.java


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