Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gjt.sp.jedit.gui
Class InputHandler  view InputHandler download InputHandler.java

java.lang.Object
  extended byorg.gjt.sp.jedit.gui.InputHandler
Direct Known Subclasses:
DefaultInputHandler

public abstract class InputHandler
extends java.lang.Object

An input handler converts the user's key strokes into concrete actions. It also takes care of macro recording and action repetition.

This class provides all the necessary support code for an input handler, but doesn't actually do any key binding logic. It is up to the implementations of this class to do so.

Version:
$Id: InputHandler.java,v 1.20 2003/08/28 22:05:24 spestov Exp $

Field Summary
protected  org.gjt.sp.jedit.EditAction lastAction
           
protected  int lastActionCount
           
protected  java.lang.String readNextChar
           
private static int REPEAT_COUNT_THRESHOLD
           
protected  int repeatCount
           
protected  org.gjt.sp.jedit.View view
           
 
Constructor Summary
InputHandler(org.gjt.sp.jedit.View view)
          Creates a new input handler.
 
Method Summary
abstract  void addKeyBinding(java.lang.String keyBinding, org.gjt.sp.jedit.EditAction action)
          Adds a key binding to this input handler.
abstract  void addKeyBinding(java.lang.String keyBinding, java.lang.String action)
          Adds a key binding to this input handler.
 org.gjt.sp.jedit.EditAction getLastAction()
          Returns the last executed action.
 int getLastActionCount()
          Returns the number of times the last action was executed.
 int getRepeatCount()
          Returns the number of times the next action will be repeated.
abstract  boolean handleKey(KeyEventTranslator.Key keyStroke)
          Handles a keystroke.
 void invokeAction(org.gjt.sp.jedit.EditAction action)
          Invokes the specified action, repeating and recording it as necessary.
 void invokeAction(java.lang.String action)
          Invokes the specified action, repeating and recording it as necessary.
 void invokeLastAction()
           
protected  void invokeReadNextChar(char ch)
           
 boolean isPrefixActive()
          Returns if a prefix key has been pressed.
 void readNextChar(java.lang.String code)
          Deprecated. Use the other form of this method instead
 void readNextChar(java.lang.String msg, java.lang.String code)
          Invokes the specified BeanShell code, replacing __char__ in the code with the next input character.
abstract  void removeAllKeyBindings()
          Removes all key bindings from this input handler.
abstract  void removeKeyBinding(java.lang.String keyBinding)
          Removes a key binding from this input handler.
 void resetLastActionCount()
          Resets the last action count.
 void setRepeatCount(int repeatCount)
          Sets the number of times the next action will be repeated.
protected  void userInput(char ch)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REPEAT_COUNT_THRESHOLD

private static final int REPEAT_COUNT_THRESHOLD
See Also:
Constant Field Values

view

protected org.gjt.sp.jedit.View view

repeatCount

protected int repeatCount

lastAction

protected org.gjt.sp.jedit.EditAction lastAction

lastActionCount

protected int lastActionCount

readNextChar

protected java.lang.String readNextChar
Constructor Detail

InputHandler

public InputHandler(org.gjt.sp.jedit.View view)
Creates a new input handler.

Method Detail

addKeyBinding

public abstract void addKeyBinding(java.lang.String keyBinding,
                                   java.lang.String action)
Adds a key binding to this input handler.


addKeyBinding

public abstract void addKeyBinding(java.lang.String keyBinding,
                                   org.gjt.sp.jedit.EditAction action)
Adds a key binding to this input handler.


removeKeyBinding

public abstract void removeKeyBinding(java.lang.String keyBinding)
Removes a key binding from this input handler.


removeAllKeyBindings

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


isPrefixActive

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


handleKey

public abstract boolean handleKey(KeyEventTranslator.Key keyStroke)
Handles a keystroke.

Since:
jEdit 4.2pre5

getRepeatCount

public int getRepeatCount()
Returns the number of times the next action will be repeated.


setRepeatCount

public void setRepeatCount(int repeatCount)
Sets the number of times the next action will be repeated.


getLastAction

public org.gjt.sp.jedit.EditAction getLastAction()
Returns the last executed action.

Since:
jEdit 2.5pre5

getLastActionCount

public int getLastActionCount()
Returns the number of times the last action was executed.

Since:
jEdit 2.5pre5

readNextChar

public void readNextChar(java.lang.String msg,
                         java.lang.String code)
Invokes the specified BeanShell code, replacing __char__ in the code with the next input character.

Since:
jEdit 3.2pre2

readNextChar

public void readNextChar(java.lang.String code)
Deprecated. Use the other form of this method instead


resetLastActionCount

public void resetLastActionCount()
Resets the last action count. This should be called when an editing operation that is not an action is invoked, for example a mouse click.

Since:
jEdit 4.0pre1

invokeAction

public void invokeAction(java.lang.String action)
Invokes the specified action, repeating and recording it as necessary.

Since:
jEdit 4.2pre1

invokeAction

public void invokeAction(org.gjt.sp.jedit.EditAction action)
Invokes the specified action, repeating and recording it as necessary.


invokeLastAction

public void invokeLastAction()

userInput

protected void userInput(char ch)

invokeReadNextChar

protected void invokeReadNextChar(char ch)