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 5364 2010-08-16 05:35:23Z mgricken $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ONLY
public static final KeyBindingManager ONLY
_keyToDataMap
private HashMap<KeyStroke,KeyBindingManager.KeyStrokeData> _keyToDataMap
_actionToDataMap
private HashMap<Action,KeyBindingManager.KeyStrokeData> _actionToDataMap
_mainFrame
private MainFrame _mainFrame
_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)
setShouldCheckConflict
public void setShouldCheckConflict(boolean bool)
getKeyStrokeData
public Collection<KeyBindingManager.KeyStrokeData> getKeyStrokeData()
put
public void put(VectorOption<KeyStroke> vkso,
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)
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
removeExistingKeyStroke
private void removeExistingKeyStroke(KeyStroke ks)
updateMenuItem
private void updateMenuItem(KeyBindingManager.KeyStrokeData data)