com.raelity.jvi
Class ColonCommands

java.lang.Object
  extended by com.raelity.jvi.ColonCommands

public class ColonCommands
extends Object

This class handles registration, command input, parsing, dispatching and in some instances execution of ":" commands. Some internal vi commands, e.g. set, are executed here. Colon commands are added to the list of avaialable commands through the register(java.lang.String, java.lang.String, java.awt.event.ActionListener) method.

A command is represented by an ActionListener. A Action could be used. Only commands that subclass ColonCommands.ColonAction can have arguments. These commands are passed a ColonCommands.ColonEvent. Actions that subclass Action are not invoked if they are disabled. The source of the ActionEvent is a JEditorPane.


Nested Class Summary
static class ColonCommands.BangAction
           
static class ColonCommands.ColonAction
          Commands that take arguments subclass this.
static class ColonCommands.ColonEvent
          The event passed to ColonCommands.ColonAction.
 
Field Summary
static ActionListener ACTION_BUFFERS
           
 
Constructor Summary
ColonCommands()
           
 
Method Summary
static List getCommandList()
          This method returns a read-only list of the registered commands.
static void register(String abbrev, String name, ActionListener l)
          Register a command; the abbrev must be unique.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_BUFFERS

public static ActionListener ACTION_BUFFERS
Constructor Detail

ColonCommands

public ColonCommands()
Method Detail

getCommandList

public static List getCommandList()
This method returns a read-only list of the registered commands. The elements of the list are AbbrevLookup.CommandElement.


register

public static void register(String abbrev,
                            String name,
                            ActionListener l)
Register a command; the abbrev must be unique. The abbrev is the "key" for the command, for example since "s" is the abbreviation for "substitue" and "se" is the abbreviation for "set" then "substitute" sorts earlier than "set" because "s" sorts earlier than "se". Consider this when adding commands, since unique prefix has nothing to do with how commands are recognized.

Throws:
IllegalArgumentException - this is thrown if the abbreviation and/or the name already exist in the list or there's a null argument.