Package org.eclipse.ui

Examples of org.eclipse.ui.IKeyBindingService


        active=false;
    }

    private void hookGlobalActions() {
        ApplicationGIS.getToolManager().contributeGlobalActions(this, getViewSite().getActionBars());
        IKeyBindingService service = getSite().getKeyBindingService();
        IAction action = deleteAction;
        getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), action);
        service.registerAction(action);
       

    }
View Full Code Here


   *
   * @param pageIndex
   *            the index of the page
   */
  private void setFocus(int pageIndex) {
    final IKeyBindingService service = getSite().getKeyBindingService();
    if (pageIndex < 0 || pageIndex >= getPageCount()) {
      // There is no selected page, so deactivate the active service.
      if (service instanceof INestableKeyBindingService) {
        final INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
        nestableService.activateKeyBindingService(null);
      } else {
        WorkbenchPlugin
            .log("MultiPageEditorPart.setFocus()   Parent key binding service was not an instance of INestableKeyBindingService.  It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
      }
      return;
    }

    final IEditorPart editor = getEditor(pageIndex);
    if (editor != null) {
      editor.setFocus();
      // There is no selected page, so deactivate the active service.
      if (service instanceof INestableKeyBindingService) {
        final INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
        if (editor != null) {
          nestableService.activateKeyBindingService(editor
              .getEditorSite());
        } else {
          nestableService.activateKeyBindingService(null);
        }
      } else {
        WorkbenchPlugin
            .log("MultiPageEditorPart.setFocus()   Parent key binding service was not an instance of INestableKeyBindingService.  It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
      }

    } else {
      // There is no selected editor, so deactivate the active service.
      if (service instanceof INestableKeyBindingService) {
        final INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
        nestableService.activateKeyBindingService(null);
      } else {
        WorkbenchPlugin
            .log("MultiPageEditorPart.setFocus()   Parent key binding service was not an instance of INestableKeyBindingService.  It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
      }

      // Give the page's control focus.
      final Control control = getControl(pageIndex);
      if (control != null) {
View Full Code Here

      menuExtenders = null;
    }

    // Remove myself from the list of nested key binding services.
    if (service != null) {
      IKeyBindingService parentService = getEditor().getSite()
          .getKeyBindingService();
      if (parentService instanceof INestableKeyBindingService) {
        INestableKeyBindingService nestableParent = (INestableKeyBindingService) parentService;
        nestableParent.removeKeyBindingService(this);
      }
View Full Code Here

                return true;
            }
        }

        // Attempt to activate a service.
        final IKeyBindingService service = (IKeyBindingService) nestedServices
                .get(nestedSite);
        if (service == null) {
            return false;
        }
View Full Code Here

        if (nestedSite == null) {
            return null;
        }

        IKeyBindingService service = (IKeyBindingService) nestedServices
                .get(nestedSite);
        if (service == null) {
            // TODO the INestedKeyBindingService API should be based on
            // IWorkbenchPartSite..
            if (nestedSite instanceof IWorkbenchPartSite) {
View Full Code Here

    public boolean removeKeyBindingService(IWorkbenchSite nestedSite) {
        if (disposed) {
      return false;
    }

        final IKeyBindingService service = (IKeyBindingService) nestedServices
                .remove(nestedSite);
        if (service == null) {
            return false;
        }

        if (service.equals(activeService)) {
            deactivateNestedService();
        }

        return true;
    }
View Full Code Here

       
        IToolManager toolManager = ApplicationGIS.getToolManager();
        toolManager.contributeGlobalActions(this, actionBars);
        toolManager.registerActionsWithPart(this);
       
        IKeyBindingService keyBindings = getSite().getKeyBindingService();
        IAction delAction = getDeleteAction();
        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delAction);
        keyBindings.registerAction(delAction);
    }
View Full Code Here

        IToolManager toolManager = ApplicationGIS.getToolManager();
        toolManager.contributeGlobalActions(this, actionBars);
        toolManager.registerActionsWithPart(this);
       
        // except for the delete key we want that one for us
        IKeyBindingService keyBindings = getSite().getKeyBindingService();

        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delAction );
        keyBindings.registerAction(delAction);
    }
View Full Code Here

        IWorkbenchPart part=(IWorkbenchPart) ApplicationGISInternal.getActiveEditor();
       
        if( part == null ) return;
       
        oldAction=ApplicationGIS.getToolManager().getDELETEAction();
        IKeyBindingService keyBindingService = part.getSite().getKeyBindingService();
        if( oldAction!=null )
            keyBindingService.unregisterAction(oldAction);

        deleteVertexHandler = new DeleteVertexHandler(handler);
        if( oldAction!=null ){
            deleteVertexHandler.setImageDescriptor(oldAction.getImageDescriptor());
            deleteVertexHandler.setDisabledImageDescriptor(oldAction.getDisabledImageDescriptor());
        }
        ApplicationGIS.getToolManager().setDELETEAction(deleteVertexHandler,part);
        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteVertexHandler);
        actionBars.updateActionBars();
        keyBindingService.registerAction(deleteVertexHandler);
    }
View Full Code Here

       
        if( part == null ) return;
       
        IWorkbenchPartSite site = part.getSite();
       
        IKeyBindingService keyBindingService = site.getKeyBindingService();
        keyBindingService.unregisterAction(deleteVertexHandler);
        deleteVertexHandler=null;
       
        ApplicationGIS.getToolManager().setDELETEAction(oldAction,part);
        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), oldAction);
        if( oldAction!=null ){
            keyBindingService.registerAction(oldAction);
        }
        oldAction=null;
       
        actionBars.updateActionBars();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IKeyBindingService

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.