本文整理汇总了Java中org.eclipse.ui.handlers.IHandlerService.createExecutionEvent方法的典型用法代码示例。如果您正苦于以下问题:Java IHandlerService.createExecutionEvent方法的具体用法?Java IHandlerService.createExecutionEvent怎么用?Java IHandlerService.createExecutionEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.handlers.IHandlerService
的用法示例。
在下文中一共展示了IHandlerService.createExecutionEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.ui.handlers.IHandlerService; //导入方法依赖的package包/类
@Override
public void run(IAction action) {
System.err.println("In run(IACtion)");
if (serviceLocator == null) {
serviceLocator = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
// Create an ExecutionEvent using Eclipse machinery.
ICommandService srv = (ICommandService) serviceLocator.getService(ICommandService.class);
IHandlerService hsrv = (IHandlerService) serviceLocator.getService(IHandlerService.class);
ExecutionEvent event = hsrv.createExecutionEvent(srv.getCommand(ActionCommands.COMPARE_WITH_ROUTE_ACTION), null);
// Fill it my current active selection.
if (event.getApplicationContext() instanceof IEvaluationContext) {
((IEvaluationContext) event.getApplicationContext()).addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, mySelection);
}
try {
handler.execute(event);
} catch (ExecutionException e) {
Activator.handleError(e.getMessage(), e, true);
}
}
示例2: run
import org.eclipse.ui.handlers.IHandlerService; //导入方法依赖的package包/类
@Override
public void run(IAction action) {
if (serviceLocator == null) {
serviceLocator = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
// Create an ExecutionEvent using Eclipse machinery.
ICommandService srv = (ICommandService) serviceLocator.getService(ICommandService.class);
IHandlerService hsrv = (IHandlerService) serviceLocator.getService(IHandlerService.class);
ExecutionEvent event = hsrv.createExecutionEvent(srv.getCommand(ActionCommands.PERSIST_TO_ROUTE_MODEL_ACTION), null);
// Fill it my current active selection.
if (event.getApplicationContext() instanceof IEvaluationContext) {
((IEvaluationContext) event.getApplicationContext()).addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, mySelection);
}
try {
handler.execute(event);
} catch (ExecutionException e) {
Activator.handleError(e.getMessage(), e, true);
}
}