Package org.gjt.sp.jedit.gui
Class InputHandler
- java.lang.Object
-
- org.gjt.sp.jedit.input.AbstractInputHandler<EditAction>
-
- org.gjt.sp.jedit.gui.InputHandler
-
- Direct Known Subclasses:
DefaultInputHandler
public abstract class InputHandler extends AbstractInputHandler<EditAction>
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.
- See Also:
DefaultInputHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected Viewview-
Fields inherited from class org.gjt.sp.jedit.input.AbstractInputHandler
bindings, currentBindings, keyEventInterceptor, lastAction, lastActionCount, PREFIX_STR, readNextChar, REPEAT_COUNT_THRESHOLD, repeatCount, shortcutOn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInputHandler(View view)Creates a new input handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EditActiongetLastAction()Returns the last executed action.intgetRepeatCount()Returns the number of times the next action will be repeated.booleanhandleKey(KeyEventTranslator.Key keyStroke)Handles a keystroke.voidinvokeAction(java.lang.String action)Invokes the specified action, repeating and recording it as necessary.voidinvokeAction(EditAction action)Invokes the specified action, repeating and recording it as necessary.voidinvokeLastAction()protected voidinvokeReadNextChar(char ch)voidprocessKeyEvent(java.awt.event.KeyEvent evt, int from, boolean global)Forwards key events directly to the input handler.voidreadNextChar(java.lang.String msg, java.lang.String code)Invokes the specified BeanShell code, replacing __char__ in the code with the next input character.voidsetRepeatCount(int repeatCount)Sets the number of times the next action will be repeated.protected voiduserInput(char ch)-
Methods inherited from class org.gjt.sp.jedit.input.AbstractInputHandler
addKeyBinding, addKeyBinding, addKeyBinding, getKeyBinding, getKeyEventInterceptor, getLastActionCount, handleKey, isPrefixActive, processKeyEventKeyStrokeHandling, removeAllKeyBindings, removeKeyBinding, resetLastActionCount, sendShortcutPrefixOff, setBindings, setCurrentBindings, setKeyEventInterceptor, toString
-
-
-
-
Field Detail
-
view
protected final View view
-
-
Constructor Detail
-
InputHandler
protected InputHandler(View view)
Creates a new input handler.- Parameters:
view- The view
-
-
Method Detail
-
handleKey
public final boolean handleKey(KeyEventTranslator.Key keyStroke)
Handles a keystroke.- Parameters:
keyStroke- The key stroke.- Returns:
- true if the input could be handled.
- Since:
- jEdit 4.2pre5
-
processKeyEvent
public void processKeyEvent(java.awt.event.KeyEvent evt, int from, boolean global)Forwards key events directly to the input handler. This is slightly faster than using a KeyListener because some Swing overhead is avoided.- Specified by:
processKeyEventin classAbstractInputHandler<EditAction>- Parameters:
evt- the keyboard eventfrom- the source, it can beView.VIEW,View.ACTION_BARorView.TEXT_AREAglobal- tell if the event comes from the DefaultKeyboardFocusManager or not- Since:
- 4.3pre7
-
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.- Parameters:
repeatCount- The repeat count
-
getLastAction
public EditAction getLastAction()
Returns the last executed action.- 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.- Parameters:
msg- The prompt to display in the status barcode- The code- Since:
- jEdit 3.2pre2
-
invokeAction
public void invokeAction(java.lang.String action)
Invokes the specified action, repeating and recording it as necessary.- Specified by:
invokeActionin classAbstractInputHandler<EditAction>- Parameters:
action- The action- Since:
- jEdit 4.2pre1
-
invokeAction
public void invokeAction(EditAction action)
Invokes the specified action, repeating and recording it as necessary.- Specified by:
invokeActionin classAbstractInputHandler<EditAction>- Parameters:
action- The action
-
invokeLastAction
public void invokeLastAction()
-
userInput
protected void userInput(char ch)
-
invokeReadNextChar
protected void invokeReadNextChar(char ch)
-
-