Examples of IHandlerService


Examples of org.eclipse.ui.handlers.IHandlerService

   *            the id
   */
  public ShowViewMenu(IWorkbenchWindow window, String id, final boolean makeFast) {
    super(id);
    this.window = window;
    final IHandlerService handlerService = (IHandlerService) window
        .getService(IHandlerService.class);
    final ICommandService commandService = (ICommandService) window
        .getService(ICommandService.class);
    final ParameterizedCommand cmd = getCommand(commandService, makeFast);
   
        showDlgAction = new Action(WorkbenchMessages.ShowView_title) {
            public void run() {
        try {
          handlerService.executeCommand(
              cmd, null);
        } catch (final ExecutionException e) {
          // Do nothing.
        } catch (NotDefinedException e) {
          // Do nothing.
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

   * @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

Examples of org.eclipse.ui.handlers.IHandlerService

     *
     * @param workbench
     * @param scope
     */
    protected void processOperations( IWorkbench workbench ){
        IHandlerService handlers = (IHandlerService)workbench.getService( IHandlerService.class );
        ICommandService commands = (ICommandService)workbench.getService( ICommandService.class );
        IMenuService menuService = (IMenuService) workbench.getService(IMenuService.class);
        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
       
        List<IConfigurationElement> list = ExtensionPointList.getExtensionPointList("org.locationtech.udig.ui.operation"); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

         * @param action
         *            the action to register.
         */
        private void registerKeybindings(IAction action) {
            final IHandler handler = new ActionHandler(action);
            final IHandlerService handlerService = (IHandlerService) PlatformUI
                    .getWorkbench().getAdapter(IHandlerService.class);
            final IHandlerActivation activation = handlerService.activateHandler(
                    action.getActionDefinitionId(), handler);
//                    new ActiveShellExpression(dialog.getShell()),
//                    ISources.ACTIVE_SHELL);
            activations.add(activation);
        }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

        /**
         * Dispose the receiver and clear out the references.
         *
         */
        public void dispose() {
            final IHandlerService handlerService = (IHandlerService) PlatformUI
                    .getWorkbench().getAdapter(IHandlerService.class);
            final Iterator iterator = activations.iterator();
            while (iterator.hasNext()) {
                handlerService.deactivateHandler((IHandlerActivation) iterator
                        .next());
            }
            activations.clear();
           
        }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

  /**
   * Create and register fHandlerSubmission.
   */
  private void activateHandler() {
    IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
    if (handlerService == null)
      return;
   
    IHandler handler= new AbstractHandler() {
      public Object execute(ExecutionEvent event) throws ExecutionException {
        if (ContentAssistHandler.this.isEnabled()) // don't call AbstractHandler#isEnabled()!
          fContentAssistant.showPossibleCompletions();
        return null;
      }
    };
    fHandlerActivation= handlerService.activateHandler(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, handler);
  }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

  /**
   * Unregister the {@link IHandlerActivation} from the shell.
   */
  private void deactivateHandler() {
    IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
    if (handlerService != null)
      handlerService.deactivateHandler(fHandlerActivation);
    fHandlerActivation= null;
  }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

  // private
  private void hookDoubleClickCommand() {
   
    viewer.addDoubleClickListener(new IDoubleClickListener() {
      public void doubleClick(DoubleClickEvent event) {
        IHandlerService handlerService = (IHandlerService) getSite()
            .getService(IHandlerService.class);
        try {
          handlerService.executeCommand(getDoubleClickCommandId(),
              null);
        } catch (Exception ex) {
          throw new RuntimeException(getDoubleClickCommandId()
              + " not found or " + ex.getMessage());
        }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

public class ModelOpenHelper
{
  public static void openModel(EObject model)
  {
    IHandlerService handlerService  = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);

        IEvaluationContext context = handlerService.getCurrentState();
        context.addVariable(ActionHelper.ME_TO_OPEN_EVALUATIONCONTEXT_VARIABLE, model);

        try
        {
          context.addVariable(ActionHelper.MECONTEXT_EVALUATIONCONTEXT_VARIABLE, ECPWorkspaceManager.getInstance().getWorkSpace().getProject(model));
            handlerService.executeCommand(ActionHelper.MEEDITOR_OPENMODELELEMENT_COMMAND_ID, null);
        }
        catch (ExecutionException e)
        {
          DialogHandler.showExceptionDialog(e);
        }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerService

   
        IContextService ctx = (IContextService) getSite().getService(IContextService.class);
        ctx.activateContext("gefEditor.context");
  }
    private void activateHandler(String actionId) {
        IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
        handlerService.activateHandler(actionId, new ActionHandler(getActionRegistry().getAction(actionId)));
    }
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.