Package org.eclipse.ui.handlers

Examples of org.eclipse.ui.handlers.IHandlerService


    }
  }
 
  private void createEmptyModel(String containerName, String fileName) throws CoreException {
    ICommandService cmdService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
   
    // get the command
    Command createPmiFileCmd = cmdService.getCommand("q_impress.pmi.plugin.commands.createEmptyPerformanceModel");
    IParameter dirParm = null;
    IParameter fileParm = null;
    try {
      dirParm = createPmiFileCmd.getParameter("q_impress.pmi.plugin.commands.createEmptyPerformanceModel.directory");
      fileParm = createPmiFileCmd.getParameter("q_impress.pmi.plugin.commands.createEmptyPerformanceModel.filename");
    } catch (NotDefinedException e) {
      this.throwCoreException("Unable to execute command, invalid parameter :" + e.getMessage(), e);
    }

    // parametrize it
    Parameterization parmDir = new Parameterization(dirParm, containerName);
    Parameterization parmFile = new Parameterization(fileParm, fileName);
    ParameterizedCommand parmCommand = new ParameterizedCommand(createPmiFileCmd, new Parameterization[] { parmDir, parmFile });

    // exec the command
    try {
      handlerService.executeCommand(parmCommand, null);
    } catch (Exception e) {
      this.throwCoreException(e.getMessage(), e);
    }
  }
View Full Code Here


 
  private void addUmlResource(String umlResourcePath, boolean doBundling,
      boolean doSync, String modelPath) throws CoreException {
   
    ICommandService cmdService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
   
    // get the command
    Command command = cmdService.getCommand(AddUmlResourceHandler.COMMAND_ID);
    IParameter umlPathParm = null;
    IParameter doBundlingParm = null;
    IParameter targetModelFileParm = null;
    try {
      umlPathParm = command.getParameter(AddUmlResourceHandler.PARAM_UML_RESOURCE_PATH);
      doBundlingParm = command.getParameter(AddUmlResourceHandler.PARAM_DO_BUNDLING);
      targetModelFileParm = command.getParameter(AddUmlResourceHandler.PARAM_TARGET_MODEL_PATH);
    } catch (NotDefinedException e) {
      this.throwCoreException("Unable to execute command, invalid parameter :" + e.getMessage(), e);
    }
 
    // parametrize it
    Parameterization parmUmlPath = new Parameterization(umlPathParm, umlResourcePath);
    Parameterization parmDoBundling = new Parameterization(doBundlingParm, Boolean.toString(doBundling));
    Parameterization parmTargetModelFile = new Parameterization(targetModelFileParm, modelPath);
    ParameterizedCommand parmCommand = new ParameterizedCommand(command,
        new Parameterization[] { parmUmlPath, parmDoBundling, parmTargetModelFile});
   
    // exec the command
    try {
      handlerService.executeCommand(parmCommand, null);
    } catch (Exception e) {
      this.throwCoreException(e.getMessage(), e);
    }
  }
View Full Code Here

   * @throws WidgetNotFoundException Thrown if the action or command id are not valid.
   */
  public void click() throws WidgetNotFoundException {
    if (commandID != null) {
      menuClickResult = null;
      final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);

      UIThreadRunnable.asyncExec(new VoidResult() {
        public void run() {
          try {
            menuClickResult = handlerService.executeCommand(commandID, null);
          } catch (Exception e) {
            throw new RuntimeException("Failed to execute the command - " + commandID, e); //$NON-NLS-1$
          }
        }
      });
View Full Code Here

     */
    public void uninstall()
    {
        if ( handlerActivation != null )
        {
            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
                IHandlerService.class );
            handlerService.deactivateHandler( handlerActivation );
            handlerActivation = null;
        }

        if ( control != null )
        {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void focusGained( FocusEvent e )
    {
        IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
            IHandlerService.class );
        if ( handlerService != null )
        {
            IHandler handler = new org.eclipse.core.commands.AbstractHandler()
            {
                public Object execute( ExecutionEvent event ) throws org.eclipse.core.commands.ExecutionException
                {
                    showPossibleCompletions();
                    return null;
                }
            };
            handlerActivation = handlerService.activateHandler(
                ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, handler );
        }
    }
View Full Code Here

     */
    public void focusLost( FocusEvent e )
    {
        if ( handlerActivation != null )
        {
            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
                IHandlerService.class );
            handlerService.deactivateHandler( handlerActivation );
            handlerActivation = null;
        }
    }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.jface.action.Action#run()
   */
  @Override
  public void run() {
    IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
    try {
      handlerService.executeCommand(AUTO_LAYOUT_COMMAND_ID, null);
    } catch (Exception ex) {
      Activator.getLogger().error(ex);
    }
  }
View Full Code Here

     */
    public void uninstall()
    {
        if ( this.handlerActivation != null )
        {
            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
                IHandlerService.class );
            handlerService.deactivateHandler( this.handlerActivation );
            this.handlerActivation = null;
        }

        if ( this.control != null )
        {
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
     */
    public void focusGained( FocusEvent e )
    {
        IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
            IHandlerService.class );
        if ( handlerService != null )
        {
            IHandler handler = new org.eclipse.core.commands.AbstractHandler()
            {
                public Object execute( ExecutionEvent event ) throws org.eclipse.core.commands.ExecutionException
                {
                    showPossibleCompletions();
                    return null;
                }
            };
            this.handlerActivation = handlerService.activateHandler(
                ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, handler );
        }
    }
View Full Code Here

     */
    public void focusLost( FocusEvent e )
    {
        if ( this.handlerActivation != null )
        {
            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
                IHandlerService.class );
            handlerService.deactivateHandler( this.handlerActivation );
            this.handlerActivation = null;
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.handlers.IHandlerService

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.