eclipse plugin: use separate output streams for stdout & stderr

This commit is contained in:
Timotei Dolean 2010-07-22 17:35:06 +00:00
parent a40747f5e0
commit 81cf422afa
2 changed files with 11 additions and 11 deletions

View File

@ -15,6 +15,7 @@ import java.util.List;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.ui.console.MessageConsole;
import wesnoth_eclipse_plugin.Constants; import wesnoth_eclipse_plugin.Constants;
import wesnoth_eclipse_plugin.Logger; import wesnoth_eclipse_plugin.Logger;
@ -129,10 +130,10 @@ public class GameUtils
// we need to add the working dir (backward compatibility) // we need to add the working dir (backward compatibility)
args.add(workingDir); args.add(workingDir);
OutputStream[] stream = new OutputStream[] { MessageConsole console = GUIUtils.createConsole("Wesnoth game:", null, true);
GUIUtils.createConsole("Wesnoth game:", null, true).newMessageStream() ExternalToolInvoker.launchTool(wesnothExec, args,
}; new OutputStream[] { console.newMessageStream() },
ExternalToolInvoker.launchTool(wesnothExec, args, stream, stream); new OutputStream[] { console.newMessageStream() });
} }
/** /**

View File

@ -192,9 +192,8 @@ public class WMLTools
try{ try{
monitor.beginTask(toolName, 1050); monitor.beginTask(toolName, 1050);
MessageConsole console = GUIUtils.createConsole(toolName + " result:", null, true); MessageConsole console = GUIUtils.createConsole(toolName + " result:", null, true);
OutputStream messageStream = console.newMessageStream(); OutputStream[] stdout = new OutputStream[]{ console.newMessageStream() };
//TODO: multiple streams? - check performance OutputStream[] stderr = new OutputStream[]{ console.newMessageStream() };
OutputStream[] stream = new OutputStream[]{ messageStream};
String location; String location;
String stdin = EditorUtils.getEditorDocument().get(); String stdin = EditorUtils.getEditorDocument().get();
@ -215,16 +214,16 @@ public class WMLTools
case WMLINDENT: case WMLINDENT:
if (selFile != null && targetPath == null) if (selFile != null && targetPath == null)
toolInvoker = WMLTools.runWMLIndent(null, stdin, false, toolInvoker = WMLTools.runWMLIndent(null, stdin, false,
null, stream); null, stdout);
else else
toolInvoker = WMLTools.runWMLIndent(location, null, false, toolInvoker = WMLTools.runWMLIndent(location, null, false,
stream, stream); stdout, stderr);
break; break;
case WMLLINT: case WMLLINT:
toolInvoker = WMLTools.runWMLLint(location, true, stream, stream); toolInvoker = WMLTools.runWMLLint(location, true, stdout, stderr);
break; break;
case WMLSCOPE: case WMLSCOPE:
toolInvoker = WMLTools.runWMLScope(location, stream, stream); toolInvoker = WMLTools.runWMLScope(location, stdout, stderr);
break; break;
} }
monitor.worked(50); monitor.worked(50);