com.borland.primetime.editor
Class ModalKeymap
java.lang.Object
|
+--com.borland.primetime.editor.DefaultKeymap
|
+--com.borland.primetime.editor.ModalKeymap
- public class ModalKeymap
- extends DefaultKeymap
This is an extension of DefaultKeymap which handles a keymap that may have
multiple modes (e.g. Emacs). This way, we do not have to continually set
and reset the keymap with the editor. Instead, a ModalKeymap is used, which
handles dispatching based on the mode the editor is in and the set of
individual keymaps which have been registered.
- See Also:
DefaultKeymap
Inner Class Summary |
static class |
ModalKeymap.ModeStateInfo
This class is used to maintain any information about the editor state that
may be specific to a particular keymap. |
Constructor Summary |
ModalKeymap(java.lang.String nm,
javax.swing.text.Keymap parent)
|
Methods inherited from class com.borland.primetime.editor.DefaultKeymap |
addActionForKeyStroke,
getAction,
getBoundActions,
getBoundKeyStrokes,
getDefaultAction,
getKeyStrokesForAction,
getName,
getResolveParent,
isLocallyDefined,
removeBindings,
removeKeyStrokeBinding,
setDefaultAction,
setResolveParent,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
DEFAULT
public static final int DEFAULT
modeKeymaps
protected java.util.Map modeKeymaps
ModalKeymap
public ModalKeymap(java.lang.String nm,
javax.swing.text.Keymap parent)
createStateInfo
public ModalKeymap.ModeStateInfo createStateInfo(EditorPane editor)
- Create a ModeStateInfo object for the specified editor.
registerKeymapForMode
public void registerKeymapForMode(javax.swing.text.Keymap map,
int mode)
- Register a subkeymap for a particular mode. This keymap will look for
actions in the specified sub keymaps when the editor is in the
specified mode.
getKeymapForMode
public javax.swing.text.Keymap getKeymapForMode(int mode)
- Get the keymap for a particular mode. This may return null if the mode
doesn't correspond to any of the registered keymaps. In this case, use
this keymap.
processKeyEvent
public void processKeyEvent(EditorPane editor,
java.awt.event.KeyEvent e)
getActionForKeyStroke
protected javax.swing.Action getActionForKeyStroke(int mode,
java.awt.event.KeyEvent e)
dispatchAction
protected boolean dispatchAction(EditorPane editor,
java.awt.event.KeyEvent e,
javax.swing.Action a)