Extension SDK

oracle.ide.keyboard
Class GrabbableFocusManager

java.lang.Object
  |
  +--javax.swing.FocusManager
        |
        +--javax.swing.DefaultFocusManager
              |
              +--oracle.ide.keyboard.GrabbableFocusManager

public final class GrabbableFocusManager
extends javax.swing.DefaultFocusManager

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.


Inner 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.
 
Fields inherited from class javax.swing.FocusManager
FOCUS_MANAGER_CLASS_PROPERTY
 
Method Summary
 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.
 void processKeyEvent(java.awt.Component focusedComponent, 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.
 
Methods inherited from class javax.swing.DefaultFocusManager
compareTabOrder, focusNextComponent, focusPreviousComponent, getComponentAfter, getComponentBefore, getFirstComponent, getLastComponent
 
Methods inherited from class javax.swing.FocusManager
disableSwingFocusManager, getCurrentManager, isFocusManagerEnabled, setCurrentManager
 
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.

processKeyEvent

public void processKeyEvent(java.awt.Component focusedComponent,
                            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()).
Overrides:
processKeyEvent in class javax.swing.DefaultFocusManager

Extension SDK