类org.eclipse.ui.handlers.IHandlerActivation源码实例Demo

下面列出了怎么用org.eclipse.ui.handlers.IHandlerActivation的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: tracecompass   文件: KeyBindingsManager.java
private void dispose() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        //During Eclipse shutdown the active workbench window is null
        return;
    }
    Object serviceObject = window.getService(IHandlerService.class);
    IHandlerService service = (IHandlerService) serviceObject;
    for (IHandlerActivation activation : fHandlerActivations) {
        service.deactivateHandler(activation);
    }
    fHandlerActivations.clear();

    fGoToMessageForKeyBinding = null;
    fFindForKeyBinding = null;
    fMoveUpForKeyBinding = null;
    fMoveDownForKeyBinding = null;
    fMoveLeftForKeyBinding = null;
    fMoveRightForKeyBinding = null;
    fShowNodeStartForKeyBinding = null;
    fShowNodeEndForKeyBinding = null;
}
 
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);
		}
	}
}
 
源代码3 项目: goclipse   文件: LangEditorActionContributor.java
@Override
public final void dispose() {
	doDispose();
	
	for (IHandlerActivation handlerActivation : handlerActivations) {
		getHandlerService_2().deactivateHandler(handlerActivation);
	}
	
	super.dispose();
}
 
源代码4 项目: goclipse   文件: LangEditorActionContributor.java
protected void activateHandler(String string, AbstractHandler handler) {
	IHandlerActivation handlerActivation = getHandlerService_2().activateHandler(string, handler);
	handlerActivations.add(handlerActivation);
}
 
 类所在包
 同包方法