本文整理匯總了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);
}
}