Extension SDK

oracle.ide.keyboard
Class GrabbableFocusManager

java.lang.Object
  extended byoracle.ide.keyboard.GrabbableFocusManager
All Implemented Interfaces:
java.awt.KeyEventDispatcher

public final class GrabbableFocusManager
extends java.lang.Object
implements java.awt.KeyEventDispatcher

This FocusManager allows to 'steal' keys on demand. The primary usage is for the multi-keystroke shortcuts system which needs to steal keys when entering a valid multi-key sequence.


Nested Class Summary
static interface GrabbableFocusManager.CtrlTabManager
          Implement this interface and return true on isManagingCtrlTabFor() if you have key bindings for managing the Ctrl+Tab keystrokes.
 
Method Summary
 boolean dispatchKeyEvent(java.awt.event.KeyEvent anEvent)
          1) handles the eatNextTypedReleased() functionality 2) If Ctrl+Tab or Ctrl+Shift+Tab is pressed, check if a parent of the focusedComponent is an instance of GrabbableFocusManager.CtrlTabManager.
 void eatNextTypedReleased()
          Eats the keyTyped and keyReleased corresponding to the last keyPressed.
static GrabbableFocusManager getGrabbableFocusManager()
           
static GrabbableFocusManager install()
          Installing the GrabbableFocusManager inserts a new FocusManager chained to the original one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

install

public static GrabbableFocusManager install()
Installing the GrabbableFocusManager inserts a new FocusManager chained to the original one.


getGrabbableFocusManager

public static GrabbableFocusManager getGrabbableFocusManager()
Returns:
the GrabbableFocusManager if it has already been installed.

eatNextTypedReleased

public void eatNextTypedReleased()
Eats the keyTyped and keyReleased corresponding to the last keyPressed.


dispatchKeyEvent

public boolean dispatchKeyEvent(java.awt.event.KeyEvent anEvent)
1) handles the eatNextTypedReleased() functionality 2) If Ctrl+Tab or Ctrl+Shift+Tab is pressed, check if a parent of the focusedComponent is an instance of GrabbableFocusManager.CtrlTabManager. If it finds one, ask it if it will handle the key event for the focused component. This is a workaround for bug1703193 "Control-Tab Keyboard Handling Of Current Editor Tab Is Wrong". What happens is that it is hardcoded in DefaultFocusManager that if the key is Ctrl+Tab (or Ctrl+Shift+Tab), the key bindings are not used and the focus is set to the next (or previous) component with focusNextComponent() (or focusPreviousComponent()).

Specified by:
dispatchKeyEvent in interface java.awt.KeyEventDispatcher

Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.