Package megamek.common
Class KeyBindParser
java.lang.Object
megamek.common.KeyBindParser
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRegister an object that wishes to be alerted when the key binds (may) have changed.static voidparseKeyBindings(MegaMekController controller) static voidregisterDefaultKeyBinds(MegaMekController controller) Each KeyCommand has a built-in default; if no key binding file can be found, we should register those defaults.static voidDe-register an object from being alerted when the key binds (may) have changed.static voidWrite the current keybindings to the default XML file.
-
Field Details
-
DEFAULT_BINDINGS_FILE
Default path to the key bindings XML file. -
KEY_BIND
-
KEY_CODE
-
KEY_MODIFIER
-
COMMAND
-
IS_REPEATABLE
-
KEYBINDS_CHANGED
- See Also:
-
-
Constructor Details
-
KeyBindParser
public KeyBindParser()
-
-
Method Details
-
parseKeyBindings
-
registerDefaultKeyBinds
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
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- thePreferenceListenerthat wants to register itself.
-
removePreferenceChangeListener
De-register an object from being alerted when the key binds (may) have changed.- Parameters:
listener- thePreferenceListenerthat wants to remove itself.
-