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

Quick Search    Search Deep

com.maddyhome.idea.vim
Class KeyHandler  view KeyHandler download KeyHandler.java

java.lang.Object
  extended bycom.maddyhome.idea.vim.KeyHandler

public class KeyHandler
extends java.lang.Object

This handlers every keystroke that the user can argType except those that are still valid hotkeys for various Idea actions. This is a singleton.


Nested Class Summary
(package private) static class KeyHandler.ActionRunner
          This was used as an experiment to execute actions as a runnable.
 
Field Summary
private  int count
           
private  int currentArg
           
private  java.util.Stack currentCmd
           
private  com.maddyhome.idea.vim.key.ParentNode currentNode
           
private static KeyHandler instance
           
private  java.util.ArrayList keys
           
private static Logger logger
           
private  int mode
           
private  TypedActionHandler origHandler
           
private static int STATE_COMMAND
           
private static int STATE_ERROR
           
private static int STATE_NEW_COMMAND
           
private static int STATE_READY
           
 
Constructor Summary
private KeyHandler()
          Creates an instance
 
Method Summary
static void executeAction(java.lang.String name, DataContext context)
          Execute an action by name
 void fullReset()
          Completely resets the state of this handler.
static KeyHandler getInstance()
          Returns a reference to the singleton instance of this class
 TypedActionHandler getOriginalHandler()
          Gets the original key handler
 void handleKey(Editor editor, javax.swing.KeyStroke key, DataContext context)
          This is the main key handler for the Vim plugin.
private  void partialReset()
          Partially resets the state of this handler.
 void reset()
          Resets the state of this handler.
 void setOriginalHandler(TypedActionHandler origHandler)
          Sets the original key handler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

private int count

keys

private java.util.ArrayList keys

mode

private int mode

currentNode

private com.maddyhome.idea.vim.key.ParentNode currentNode

currentCmd

private java.util.Stack currentCmd

currentArg

private int currentArg

origHandler

private TypedActionHandler origHandler

instance

private static KeyHandler instance

STATE_NEW_COMMAND

private static final int STATE_NEW_COMMAND
See Also:
Constant Field Values

STATE_COMMAND

private static final int STATE_COMMAND
See Also:
Constant Field Values

STATE_READY

private static final int STATE_READY
See Also:
Constant Field Values

STATE_ERROR

private static final int STATE_ERROR
See Also:
Constant Field Values

logger

private static Logger logger
Constructor Detail

KeyHandler

private KeyHandler()
Creates an instance

Method Detail

getInstance

public static KeyHandler getInstance()
Returns a reference to the singleton instance of this class


setOriginalHandler

public void setOriginalHandler(TypedActionHandler origHandler)
Sets the original key handler


getOriginalHandler

public TypedActionHandler getOriginalHandler()
Gets the original key handler


handleKey

public void handleKey(Editor editor,
                      javax.swing.KeyStroke key,
                      DataContext context)
This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for processing.


executeAction

public static void executeAction(java.lang.String name,
                                 DataContext context)
Execute an action by name


partialReset

private void partialReset()
Partially resets the state of this handler. Resets the command count, clears the key list, resets the key tree node to the root for the current mode we are in.


reset

public void reset()
Resets the state of this handler. Does a partial reset then resets the mode, the command, and the argument


fullReset

public void fullReset()
Completely resets the state of this handler. Resets the command mode to normal, resets, and clears the selected register.