Package docking

Class KeyBindingOverrideKeyEventDispatcher

java.lang.Object
docking.KeyBindingOverrideKeyEventDispatcher
All Implemented Interfaces:
KeyEventDispatcher

public class KeyBindingOverrideKeyEventDispatcher extends Object implements KeyEventDispatcher
Allows Ghidra to give preference to its key event processing over the default Java key event processing. See dispatchKeyEvent(KeyEvent) for a more detailed explanation of how Ghidra processes key events.

install() must be called in order to install this Singleton into Java's key event processing system.

  • Constructor Details

    • KeyBindingOverrideKeyEventDispatcher

      public KeyBindingOverrideKeyEventDispatcher()
  • Method Details

    • dispatchKeyEvent

      public boolean dispatchKeyEvent(KeyEvent event)
      Overridden to change the Java's key event processing to insert Ghidra's top level tool key bindings into the event processing. Java's normal key event processing is:
      1. KeyListeners on the focused Component
      2. InputMap and ActionMap actions for the Component
      3. InputMap and ActionMap actions for the Component's parent, and so on up the Swing hierarchy
      Ghidra has altered this flow to be:
      1. Reserved keybinding actions
      2. KeyListeners on the focused Component
      3. InputMap and ActionMap actions for the Component
      4. Ghidra tool-level actions
      5. InputMap and ActionMap actions for the Component's parent, and so on up the Swing hierarchy
      This updated key event processing allows individual components to handle key events first, but then allows global Ghidra key bindings to be processed, allowing normal Java processing after Ghidra has had its chance to process the event.

      There are some exceptions to this processing chain:

      1. We don't do any processing when the focused component is an instance of JTextComponent.
      2. We don't do any processing if the active window is an instance of DockingDialog.
      Specified by:
      dispatchKeyEvent in interface KeyEventDispatcher
      See Also: