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