Search code examples
eclipseeclipse-plugineclipse-pde

Eclipse Plugin Read Std Error


I am trying to write an Eclipse plugin which needs to read the std error inside eclipse. E.g. the red text that appears in the console.

I cannot find the correct extension point for something like this. The best I could find was org.eclipse.ui.console.consolePatternMatchListeners but this just matches console lines regardless of their origin.

Anyone know a method to do this or the correct extension point?


Solution

  • Using internal code you can add listner to ErrorStream

    ProcessConsole con = ...
    con.getProcess().getStreamsProxy().getErrorStreamMonitor().addListener(new IStreamListener() {
        @Override
        public void streamAppended(String text, IStreamMonitor monitor) {
            System.out.println("text=" + text);
        }
    });