Package org.eclipse.e4.core.commands

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


      } 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

      } 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

  }

  @Override
  public ServerResource create(Class<? extends ServerResource> clazz, Request request, Response response)
  {
    IEclipseContext childContext = serviceContext.createChild("ResourceContext");
    diLock.lock(); // The lock is required because ContextInjectionFactory.make() is not thread safe

    try
    {
      InjectedResource serverResource = (InjectedResource) ContextInjectionFactory.make(clazz, childContext);
View Full Code Here

  @Execute
  public void onExecute() {
    eventBroker.subscribe(IThemeEngine.Events.THEME_CHANGED,
        new EventHandler() {
          public void handleEvent(Event event) {
            ITheme currentTheme = (ITheme) event
                .getProperty(IThemeEngine.Events.THEME);
            // if (!prefDarker.getBoolean(
            // THEME_DARKER_PREF_THEMEENABLED, false))
            if (currentTheme.getId().equals(THEME_DARKER_ID)) {
              setupPreferences();
              isLastThemeDarker = true;
              DarkerWeavingHook.enableWeaving();
              hookDarkerCore();
            } else if (isLastThemeDarker) {
View Full Code Here

    try {
      URL url = SettingsDialog.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
View Full Code Here

    try {
      URL url = AudioSettingsTab.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
View Full Code Here

    try {
      URL url = Application.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
View Full Code Here

    try {
      URL url = AboutPageTab.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
  }
View Full Code Here

    try {
      URL url = HelpPageTab.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.e4.core.commands.EHandlerService

Copyright © 2018 www.massapicom. 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.