Пример #1
0
 /**
  * Run command with specified id
  *
  * @param service
  * @param id
  * @param event
  */
 public static void executeCommand(IHandlerService service, String id, Event event) {
   try {
     service.executeCommand(id, event);
   } catch (ExecutionException e) {
     Activator.handleError(e.getMessage(), e, false);
   } catch (NotDefinedException e) {
     Activator.handleError(e.getMessage(), e, false);
   } catch (NotEnabledException e) {
     Activator.handleError(e.getMessage(), e, false);
   } catch (NotHandledException e) {
     Activator.handleError(e.getMessage(), e, false);
   }
 }
Пример #2
0
 public static void executeCommand(IViewSite site, String command) {
   ICommandService cmdService = (ICommandService) site.getService(ICommandService.class);
   IHandlerService hdlService = (IHandlerService) site.getService(IHandlerService.class);
   Command cmd = cmdService.getCommand(command);
   try {
     hdlService.executeCommand(cmd.getId(), null);
   } catch (ExecutionException e) {
     e.printStackTrace();
   } catch (NotDefinedException e) {
     e.printStackTrace();
   } catch (NotEnabledException e) {
     e.printStackTrace();
   } catch (NotHandledException e) {
     e.printStackTrace();
   }
 }