org.gjt.sp.jedit.gui
Class DefaultInputHandler

java.lang.Object
  extended by org.gjt.sp.jedit.gui.InputHandler
      extended by org.gjt.sp.jedit.gui.DefaultInputHandler

public class DefaultInputHandler
extends InputHandler

The default input handler. It maps sequences of keystrokes into actions and inserts key typed events into the text area.


Field Summary
static java.lang.Object PREFIX_STR
           
protected  boolean shortcutOn
           
 
Fields inherited from class org.gjt.sp.jedit.gui.InputHandler
lastAction, lastActionCount, readNextChar, repeatCount, view
 
Constructor Summary
DefaultInputHandler(View view)
          Creates a new input handler with no key bindings defined.
DefaultInputHandler(View view, DefaultInputHandler copy)
          Creates a new input handler with the same set of key bindings as the one specified.
DefaultInputHandler(View view, java.util.Hashtable bindings)
          Creates a new input handler with no key bindings defined.
 
Method Summary
 void addKeyBinding(java.lang.String keyBinding, EditAction action)
          Adds a key binding to this input handler.
 void addKeyBinding(java.lang.String keyBinding, java.lang.Object action)
          Adds a key binding to this input handler.
 void addKeyBinding(java.lang.String keyBinding, java.lang.String action)
          Adds a key binding to this input handler.
 java.lang.Object getKeyBinding(java.lang.String keyBinding)
          Returns either an edit action, or a hashtable if the specified key is a prefix.
static java.lang.String getModifierString(java.awt.event.InputEvent evt)
          Returns a string containing symbolic modifier names set in the specified event.
static char getSymbolicModifierName(int mod)
          Returns a the symbolic modifier name for the specified Java modifier flag.
 boolean handleKey(KeyEventTranslator.Key keyStroke)
          Handles the given keystroke.
 boolean isPrefixActive()
          Returns if a prefix key has been pressed.
 void removeAllKeyBindings()
          Removes all key bindings from this input handler.
 void removeKeyBinding(java.lang.String keyBinding)
          Removes a key binding from this input handler.
protected  void sendShortcutPrefixOff()
          If
 void setBindings(java.util.Hashtable bindings)
          Replace the set of key bindings.
 void setCurrentBindings(java.util.Hashtable bindings)
           
 
Methods inherited from class org.gjt.sp.jedit.gui.InputHandler
getLastAction, getLastActionCount, getRepeatCount, invokeAction, invokeAction, invokeLastAction, invokeReadNextChar, readNextChar, readNextChar, resetLastActionCount, setRepeatCount, userInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shortcutOn

protected boolean shortcutOn

PREFIX_STR

public static java.lang.Object PREFIX_STR
Constructor Detail

DefaultInputHandler

public DefaultInputHandler(View view,
                           java.util.Hashtable bindings)
Creates a new input handler with no key bindings defined.

Parameters:
view - The view
bindings - An explicitly-specified set of key bindings, must not be null.
Since:
jEdit 4.3pre1

DefaultInputHandler

public DefaultInputHandler(View view)
Creates a new input handler with no key bindings defined.

Parameters:
view - The view

DefaultInputHandler

public DefaultInputHandler(View view,
                           DefaultInputHandler copy)
Creates a new input handler with the same set of key bindings as the one specified. Note that both input handlers share a pointer to exactly the same key binding table; so adding a key binding in one will also add it to the other.

Parameters:
copy - The input handler to copy key bindings from
view - The view
Method Detail

addKeyBinding

public void addKeyBinding(java.lang.String keyBinding,
                          java.lang.String action)
Adds a key binding to this input handler. The key binding is a list of white space separated key strokes of the form [modifiers+]key where modifier is C for Control, A for Alt, or S for Shift, and key is either a character (a-z) or a field name in the KeyEvent class prefixed with VK_ (e.g., BACK_SPACE)

Specified by:
addKeyBinding in class InputHandler
Parameters:
keyBinding - The key binding
action - The action
Since:
jEdit 4.2pre1

addKeyBinding

public void addKeyBinding(java.lang.String keyBinding,
                          EditAction action)
Adds a key binding to this input handler. The key binding is a list of white space separated key strokes of the form [modifiers+]key where modifier is C for Control, A for Alt, or S for Shift, and key is either a character (a-z) or a field name in the KeyEvent class prefixed with VK_ (e.g., BACK_SPACE)

Specified by:
addKeyBinding in class InputHandler
Parameters:
keyBinding - The key binding
action - The action

addKeyBinding

public void addKeyBinding(java.lang.String keyBinding,
                          java.lang.Object action)
Adds a key binding to this input handler. The key binding is a list of white space separated key strokes of the form [modifiers+]key where modifier is C for Control, A for Alt, or S for Shift, and key is either a character (a-z) or a field name in the KeyEvent class prefixed with VK_ (e.g., BACK_SPACE)

Parameters:
keyBinding - The key binding
action - The action
Since:
jEdit 4.3pre1

removeKeyBinding

public void removeKeyBinding(java.lang.String keyBinding)
Removes a key binding from this input handler. This is not yet implemented.

Specified by:
removeKeyBinding in class InputHandler
Parameters:
keyBinding - The key binding

removeAllKeyBindings

public void removeAllKeyBindings()
Removes all key bindings from this input handler.

Specified by:
removeAllKeyBindings in class InputHandler

getKeyBinding

public java.lang.Object getKeyBinding(java.lang.String keyBinding)
Returns either an edit action, or a hashtable if the specified key is a prefix.

Parameters:
keyBinding - The key binding
Since:
jEdit 3.2pre5

isPrefixActive

public boolean isPrefixActive()
Returns if a prefix key has been pressed.

Overrides:
isPrefixActive in class InputHandler

setBindings

public void setBindings(java.util.Hashtable bindings)
Replace the set of key bindings.

Since:
jEdit 4.3pre1

setCurrentBindings

public void setCurrentBindings(java.util.Hashtable bindings)

handleKey

public boolean handleKey(KeyEventTranslator.Key keyStroke)
Handles the given keystroke.

Specified by:
handleKey in class InputHandler
Parameters:
keyStroke - The key stroke
Since:
jEdit 4.2pre5

sendShortcutPrefixOff

protected void sendShortcutPrefixOff()
If


getSymbolicModifierName

public static char getSymbolicModifierName(int mod)
Returns a the symbolic modifier name for the specified Java modifier flag.

Parameters:
mod - A modifier constant from InputEvent
Since:
jEdit 4.1pre3

getModifierString

public static java.lang.String getModifierString(java.awt.event.InputEvent evt)
Returns a string containing symbolic modifier names set in the specified event.

Parameters:
evt - The event
Since:
jEdit 4.1pre3