Most plugin shells will need to report compiler errors and such. To do this, you will first need to create and register an ErrorSource; see the ErrorList plugin documentation for details. You will also need to add the errors to the error source at some stage. There are two ways of doing this:
Manually, by having the shell check for appropriate error conditions, and add errors as necessary.
Alternatively, you can pass lines of output to the parseLine() method of the runmcConsolePlugin class (contained in the runmcconsole package). This method will attempt to match a specified line of text against a set of error regular expressions (see the section called “Error parsing” for details). The method prototype is as follows:
public static int parseLine( | View ? | view, |
? | String ? | text, |
? | String ? | directory, |
? | DefaultErrorSource ? | errorSource) ; |
The text parameter must be a single line of text. directory is a path name; file names in the output will be resolved relative to this directory. Finally, errorSource is your plugin's error source instance; any errors parsed from the output will be added here.
The return value is one of ErrorSource.WARNING, ErrorSource.ERROR, or NO_ERROR. If you call parseLine() before printing the output to a runmcconsole window instance, you can use the parseLine() return value to choose a color to use for the output.