edu.rice.cs.drjava.ui
Class KeyBindingManager
java.lang.Object
|
+--edu.rice.cs.drjava.ui.KeyBindingManager
- public class KeyBindingManager
- extends Object
Contains Hashtables that are used in the key-binding process along with
methods to build them and access their contents. Performs the
assigning of keys to actions, checking for and resolving conflicts, and
setting appropriate menu accelerators
- Version:
- $Id: KeyBindingManager.java,v 1.6 2002/09/02 21:24:12 csreis Exp $
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
Singleton
public static final KeyBindingManager Singleton
_keyToDataMap
private Hashtable _keyToDataMap
_actionToDataMap
private Hashtable _actionToDataMap
_mainFrame
private MainFrame _mainFrame
_actionMap
private ActionMap _actionMap
_shouldCheckConflict
private boolean _shouldCheckConflict
- Should only check conflicts when the keyboard configuration options
are first entered into the maps. Afterwards, the GUI configuration
will warn the user about actions whose key-bindings will be overwritten
in the GetKeyDialog, and the preferences panel will reflect the changes.
When the user hit apply, no conflicts should exist in the preferences panel,
and there should be no need to check for conflicts in the configuration.
KeyBindingManager
private KeyBindingManager()
setMainFrame
public void setMainFrame(MainFrame mainFrame)
setActionMap
public void setActionMap(ActionMap actionMap)
- Sets the ActionMap
- Parameters:
am
- the ActionMap to set to
setShouldCheckConflict
public void setShouldCheckConflict(boolean bool)
getKeyStrokeData
public Enumeration getKeyStrokeData()
put
public void put(Option kso,
Action a,
JMenuItem jmi,
String name)
get
public Action get(KeyStroke ks)
- Takes a KeyStroke and gets its Action from the keyToActionMap
- Parameters:
ks
- KeyStroke to look up- Returns:
- the corresponding Action or null if there is no Action associated
with the KeyStroke
getName
public String getName(KeyStroke ks)
getName
public String getName(Action a)
addShiftAction
public void addShiftAction(Option opt,
String shiftS)
- Takes an option, its name, and the name of the corresponding
selection action and returns the selection action after putting
the appropriate data pairs into their respective Hashtables
Also adds new KeyStrokOptionListeners to the non-shifted Actions
- Parameters:
opt
- the KeyStroke Option of the Actions
- the name of the ActionshiftS
- the name of the Selection Action
addShiftModifier
public KeyStroke addShiftModifier(KeyStroke k)
- Takes a KeyStroke and returns a KeyStroke that is the same that
has the shift modifier
- Parameters:
k
- a KeyStroke
shouldUpdate
private boolean shouldUpdate(KeyStroke ks,
Action a)
- Inserts a KeyStroke/Action pair into the _keyToActionMap. Checks for
conflicts and displays an option pane if they are any.
- Parameters:
ks
- the KeyStrokea
- the Action- Returns:
- whether a map insertion was done