|
Re: Add a console view in RCP(eclipse indigo-3.7) [message #1257226 is a reply to message #1234081] |
Wed, 26 February 2014 07:30 |
|
To enable the log in the Console view, you have to create your console instance to write in it.
For example, here is a piece of code to help you.
/**
* Reroute default output streams to a new console, added to console view.
*/
public static void linkDefaultOutStreamToConsole() {
// Create a msg console
final MessageConsole console = new MessageConsole("Console", null);
// Add it to console manager
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {vConsole });
PrintStream printStream = new PrintStream(console.newMessageStream());
// Link standard output stream to the console
System.setOut(printStream);
// Link error output stream to the console
System.setErr(printStream);
}
/**
* Reset output stream to system ones.
*/
public static void unlinkDefaultOutStreamToConsole() {
System.setOut(System.out);
System.setErr(System.err);
}
|
|
|
Powered by
FUDForum. Page generated in 1.29953 seconds