分类:
2008-10-15 16:36:10
//org.eclipse.ui.console
MessageConsoleStream console = this.openLogConsole("RCP",
"Informatiol",
"org.eclipse.workbench.ui.ide");
console.println(new Date(System.currentTimeMillis())
+ ":selected!");
public MessageConsoleStream openLogConsole(String domainName,
String stationId, String applicationId) {
System.err.println("openLogConsole(domain=" + domainName + ",
station="
+ stationId + ", app=" + applicationId + ")");
/*
* get console name and create a new console
*/
StringBuffer consoleName = new StringBuffer(domainName);
if (stationId != null) {
consoleName.append(">" + stationId);
if (applicationId != null) {
consoleName.append(">" + applicationId);
}
}
MessageConsole console = new
MessageConsole(consoleName.toString(),
null);
final MessageConsoleStream consoleStream =
console.newMessageStream();
consoleStream.setColor(Display.getDefault().getSystemColor(
SWT.COLOR_BLUE));
/*
* show view
*/
IConsoleManager manager = (IConsoleManager)
ConsolePlugin.getDefault()
.getConsoleManager();
manager
.addConsoles(new org.eclipse.ui.console.IConsole[] {
(org.eclipse.ui.console.IConsole) console });
manager.showConsoleView (console);
return consoleStream;
}