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

Quick Search    Search Deep

com.maddyhome.idea.vim.command
Class CommandState  view CommandState download CommandState.java

java.lang.Object
  extended bycom.maddyhome.idea.vim.command.CommandState

public class CommandState
extends java.lang.Object

This singleton maintains various state information about commands being run


Nested Class Summary
private  class CommandState.State
           
 
Field Summary
private  Command command
           
private  CommandState.State defaultState
           
private  boolean isRecording
           
private  Command lastChange
           
private  char lastRegister
           
private  int mode
           
static int MODE_COMMAND
          Indicates a runtime state of being in command mode
static int MODE_EX_ENTRY
          Indicates a runtime state of entering an Ex command
static int MODE_INSERT
          Indicates a runtime state of being in insert mode
static int MODE_REPEAT
          Indicates a runtime state of being in repeat mode
static int MODE_REPLACE
          Indicates a runtime state of being in replace mode
static int MODE_VISUAL
          Indicates a runtime state of being in visual mode
private  java.util.Stack modes
           
private static CommandState ourInstance
           
static int SUBMODE_INSERT
           
static int SUBMODE_REPLACE
           
static int SUBMODE_SINGLE_COMMAND
           
 
Constructor Summary
private CommandState()
          Signleton, no public object creation
 
Method Summary
private  CommandState.State currentState()
           
 Command getCommand()
          Gets the currently executing command
static CommandState getInstance()
          Gets the command state singleton
 Command getLastChangeCommand()
          Gets the last command that performed a change
 char getLastChangeRegister()
          Gets the register used by the last saved change command
 int getMappingMode()
          Gets the current key mapping mode
 int getMode()
          Gets the current mode the command is in
private  java.lang.String getStatusString(int pos)
           
 int getSubMode()
           
 boolean isRecording()
           
 void popState()
           
 void pushState(int mode, int submode, int mapping)
           
 void reset()
          Resets the command, mode, visual mode, and mapping mode to initial values.
 void saveLastChangeCommand(Command cmd)
          Saves the last command that performed a change.
 void setCommand(Command cmd)
          This maintains the current command that is being executed
 void setRecording(boolean val)
           
 void setSubMode(int submode)
           
 void toggleInsertOverwrite()
          Toggles the insert/overwrite state.
private  void updateStatus()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_COMMAND

public static final int MODE_COMMAND
Indicates a runtime state of being in command mode

See Also:
Constant Field Values

MODE_INSERT

public static final int MODE_INSERT
Indicates a runtime state of being in insert mode

See Also:
Constant Field Values

MODE_REPLACE

public static final int MODE_REPLACE
Indicates a runtime state of being in replace mode

See Also:
Constant Field Values

MODE_REPEAT

public static final int MODE_REPEAT
Indicates a runtime state of being in repeat mode

See Also:
Constant Field Values

MODE_VISUAL

public static final int MODE_VISUAL
Indicates a runtime state of being in visual mode

See Also:
Constant Field Values

MODE_EX_ENTRY

public static final int MODE_EX_ENTRY
Indicates a runtime state of entering an Ex command

See Also:
Constant Field Values

SUBMODE_SINGLE_COMMAND

public static final int SUBMODE_SINGLE_COMMAND
See Also:
Constant Field Values

SUBMODE_INSERT

public static final int SUBMODE_INSERT
See Also:
Constant Field Values

SUBMODE_REPLACE

public static final int SUBMODE_REPLACE
See Also:
Constant Field Values

modes

private java.util.Stack modes

defaultState

private CommandState.State defaultState

command

private Command command

mode

private int mode

lastChange

private Command lastChange

lastRegister

private char lastRegister

isRecording

private boolean isRecording

ourInstance

private static CommandState ourInstance
Constructor Detail

CommandState

private CommandState()
Signleton, no public object creation

Method Detail

getInstance

public static CommandState getInstance()
Gets the command state singleton


getCommand

public Command getCommand()
Gets the currently executing command


setCommand

public void setCommand(Command cmd)
This maintains the current command that is being executed


pushState

public void pushState(int mode,
                      int submode,
                      int mapping)

popState

public void popState()

getMode

public int getMode()
Gets the current mode the command is in


getSubMode

public int getSubMode()

setSubMode

public void setSubMode(int submode)

updateStatus

private void updateStatus()

getStatusString

private java.lang.String getStatusString(int pos)

toggleInsertOverwrite

public void toggleInsertOverwrite()
Toggles the insert/overwrite state. If currently insert, goto replace mode. If currently replace, goto insert mode.


reset

public void reset()
Resets the command, mode, visual mode, and mapping mode to initial values.


getMappingMode

public int getMappingMode()
Gets the current key mapping mode


getLastChangeCommand

public Command getLastChangeCommand()
Gets the last command that performed a change


getLastChangeRegister

public char getLastChangeRegister()
Gets the register used by the last saved change command


saveLastChangeCommand

public void saveLastChangeCommand(Command cmd)
Saves the last command that performed a change. It also preserves the register the command worked with.


isRecording

public boolean isRecording()

setRecording

public void setRecording(boolean val)

currentState

private CommandState.State currentState()