1
/*******************************************************************************
2
* Copyright (c) 2006 IBM Corporation.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
10
*******************************************************************************/
12
package org.eclipse.linuxtools.systemtap.ui.consolelog.structures;
14
import org.eclipse.linuxtools.systemtap.ui.consolelog.internal.Localization;
15
import org.eclipse.linuxtools.systemtap.ui.consolelog.views.ErrorView;
18
* A class push data to both the </code>ScriptConsole</code> and the ErrorView
21
public class ErrorStreamDaemon extends ConsoleStreamDaemon {
22
public ErrorStreamDaemon(ScriptConsole console, ErrorView errorWindow, IErrorParser parser) {
25
outputData = new StringBuilder();
28
errorView = errorWindow;
33
* Prints out the new output data to the console and parses it and sends it to the
36
protected void pushData() {
37
if(output.startsWith(Localization.getString("ErrorStreamDaemon.Password")))
38
output = output.substring(Localization.getString("ErrorStreamDaemon.Password").length());
42
outputData.append(output);
44
/* Since we never know when the last set of data is comming we don't clear the
45
* errorStream in the hope of getting a more complete error message. As a result
46
* the parser will always return what we already had. Clear removes anything
47
* that was added before.
49
if(null != errorView) {
50
String[][] errors = parser.parseOutput(outputData.toString());
54
for(int i=0; i<errors.length; i++)
55
errorView.add(errors[i]);
61
* Disposes of all internal references in the class. No method should be called after this.
63
public void dispose() {
67
outputData.delete(0, outputData.length());
73
private ErrorView errorView;
74
private StringBuilder outputData;
75
private IErrorParser parser;