console
Class CommandOutputParser

java.lang.Object
  extended by console.CommandOutputParser

public class CommandOutputParser
extends java.lang.Object

Parses the output of a running Process. Refactored from ConsolePlugin.parseLine(). This class contains all code related to parsing the output of console commands. Derived shells can return extended versions of this for handling their own Output processing by overriding @ref Shell.createOutputParser()

Since:
Console 4.2
Version:
$Id: CommandOutputParser.java 11495 2007-12-31 21:51:25Z ezust $
Author:
ezust

Field Summary
protected  Console console
           
protected  errorlist.DefaultErrorSource.DefaultError lastError
           
 
Constructor Summary
CommandOutputParser(org.gjt.sp.jedit.View v, errorlist.DefaultErrorSource es, java.awt.Color defaultColor)
          Creates an instance of an output parser.
 
Method Summary
protected  void display(java.awt.Color c, java.lang.String text)
           
protected  void display(java.lang.String text)
           
 void finishErrorParsing()
           
 java.awt.Color getColor()
           
 int processLine(java.lang.String text)
          Processes a line without displaying it to the Output
 int processLine(java.lang.String text, boolean disp)
          Process a line of input.
 void setDirectory(java.lang.String currentDirectory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastError

protected errorlist.DefaultErrorSource.DefaultError lastError

console

protected Console console
Constructor Detail

CommandOutputParser

public CommandOutputParser(org.gjt.sp.jedit.View v,
                           errorlist.DefaultErrorSource es,
                           java.awt.Color defaultColor)
Creates an instance of an output parser. An output parser will send coloured output to the Shell of the given View.

Parameters:
v - - the current View
es - - An ErrorSource which corresponds to the plugin which is generating the errors.
defaultColor - - the default color to use when errors are not found TODO: Use the es to determine which errormatchers to look at?
Method Detail

processLine

public final int processLine(java.lang.String text)
Processes a line without displaying it to the Output


processLine

public int processLine(java.lang.String text,
                       boolean disp)
Process a line of input. Checks all the enabled ErrorMatchers' regular expressions, sets the proper current color, changes directories if there are chdir patterns found. Adds errors to the ErrorList plugin if necessary.

Parameters:
text - a line of text
disp - if true, will also send to the Output.
Returns:
-1 if there is no error, or ErrorSource.WARNING, or ErrorSource.ERROR if there is a warning or an error found in text.

getColor

public java.awt.Color getColor()

setDirectory

public void setDirectory(java.lang.String currentDirectory)

display

protected void display(java.awt.Color c,
                       java.lang.String text)

display

protected void display(java.lang.String text)

finishErrorParsing

public void finishErrorParsing()