Examples of EHandlerService


Examples of org.eclipse.e4.core.commands.EHandlerService

      final Event trigger) throws CommandException {

    // Reset the key binding state (close window, clear status line, etc.)
    resetState(false);

    final EHandlerService handlerService = getHandlerService();
    final Command command = parameterizedCommand.getCommand();

    final IEclipseContext staticContext = EclipseContextFactory.create("keys-staticContext"); //$NON-NLS-1$
    staticContext.set(Event.class, trigger);

    final boolean commandDefined = command.isDefined();
    // boolean commandEnabled;
    boolean commandHandled;

    try {
      // commandEnabled = handlerService.canExecute(parameterizedCommand, staticContext);
      commandHandled = HandlerServiceImpl.lookUpHandler(context, command.getId()) != null;

      try {
        handlerService.executeHandler(parameterizedCommand, staticContext);
      } catch (final Exception e) {
        commandHandled = false;
        e.printStackTrace();
      }
      /*
 
View Full Code Here

Examples of org.eclipse.e4.core.commands.EHandlerService

      } finally {
        runContext.dispose();
      }
    } else if( item instanceof MHandledItem ) {
      MHandledItem handledItem = (MHandledItem) item;
      EHandlerService service = (EHandlerService) context.get(EHandlerService.class.getName());
      if( service == null ) {
        return false;
      }
     
      ParameterizedCommand cmd = handledItem.getWbCommand();
      if (cmd == null) {
        cmd = generateParameterizedCommand(handledItem, context);
        handledItem.setWbCommand(cmd);
      }
      if (cmd == null) {
        return false;
      }
     
      final IEclipseContext runContext = context.createChild("HI-ToolItem");
      try {
        ContributionsAnalyzer.populateModelInterfaces(item,runContext, item.getClass().getInterfaces());
        return service.canExecute(cmd, runContext);
      } finally {
        runContext.dispose();       
      }
    }
   
View Full Code Here

Examples of org.eclipse.e4.core.commands.EHandlerService

      } finally {
        runContext.dispose()
      }
    } else if( item instanceof MHandledItem ) {
      MHandledItem handledItem = (MHandledItem) item;
      EHandlerService service = (EHandlerService) context.get(EHandlerService.class.getName());
      ParameterizedCommand cmd = handledItem.getWbCommand();
      if (cmd == null) {
        cmd = generateParameterizedCommand(handledItem, context);
        handledItem.setWbCommand(cmd);
      }
      if (cmd == null) {
        logger.error("Failed to execute: " + handledItem.getCommand());
        return;
      }
      final IEclipseContext runContext = context.createChild("HI-ToolItem");
      try {
        ContributionsAnalyzer.populateModelInterfaces(item,runContext, item.getClass().getInterfaces());
        service.executeHandler(cmd, runContext);
      } finally {
        runContext.dispose();       
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.