Class KeyBindParser

java.lang.Object
megamek.common.KeyBindParser

public class KeyBindParser extends Object
This class provides a static method to read in the defaultKeybinds.xml and set all of the KeyCommandBind's based on the specifications in the XML file.
  • Field Details

    • DEFAULT_BINDINGS_FILE

      public static String DEFAULT_BINDINGS_FILE
      Default path to the key bindings XML file.
    • KEY_BIND

      public static String KEY_BIND
    • KEY_CODE

      public static String KEY_CODE
    • KEY_MODIFIER

      public static String KEY_MODIFIER
    • COMMAND

      public static String COMMAND
    • IS_REPEATABLE

      public static String IS_REPEATABLE
    • KEYBINDS_CHANGED

      public static final String KEYBINDS_CHANGED
      See Also:
  • Constructor Details

    • KeyBindParser

      public KeyBindParser()
  • Method Details

    • parseKeyBindings

      public static void parseKeyBindings(MegaMekController controller)
    • registerDefaultKeyBinds

      public static void registerDefaultKeyBinds(MegaMekController controller)
      Each KeyCommand has a built-in default; if no key binding file can be found, we should register those defaults.
    • writeKeyBindings

      public static void writeKeyBindings()
      Write the current keybindings to the default XML file.
    • addPreferenceChangeListener

      public static void addPreferenceChangeListener(IPreferenceChangeListener listener)
      Register an object that wishes to be alerted when the key binds (may) have changed. When the keybinds change, a PreferenceChange with the name KeyBindParser.KEYBINDS_CHANGED is fired.
      Parameters:
      listener - the PreferenceListener that wants to register itself.
    • removePreferenceChangeListener

      public static void removePreferenceChangeListener(IPreferenceChangeListener listener)
      De-register an object from being alerted when the key binds (may) have changed.
      Parameters:
      listener - the PreferenceListener that wants to remove itself.