[logback-dev] svn commit: r1496 - logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/actions
noreply.seb at qos.ch
noreply.seb at qos.ch
Fri Mar 30 15:45:50 CEST 2007
Author: seb
Date: Fri Mar 30 15:45:49 2007
New Revision: 1496
Modified:
logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/actions/OpenStackTraceAction.java
Log:
Fixed bug where the StackTrace console would not appear when the user had removed it from the ConsoleView
Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/actions/OpenStackTraceAction.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/actions/OpenStackTraceAction.java (original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/actions/OpenStackTraceAction.java Fri Mar 30 15:45:49 2007
@@ -30,8 +30,7 @@
public OpenStackTraceAction(LogbackView view, String text) {
super(text);
this.view = view;
- console = new JavaStackTraceConsole();
- ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
+ initConsole();
}
@Override
@@ -47,9 +46,35 @@
buf.append(lines[i]).append(NEW_LINE);
}
+ //check that the user did not remove our console from the ConsoleView
+ boolean stillRegistered = checkRegistration();
+ if (!stillRegistered) {
+ registerConsole();
+ }
+
console.clearConsole();
console.getDocument().set(buf.toString());
ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
}
+
+ private boolean checkRegistration() {
+ IConsole[]consoleArray = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
+ for (int i = 0; i < consoleArray.length; i++) {
+ IConsole c = consoleArray[i];
+ if (c == console) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void registerConsole() {
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
+ }
+
+ private void initConsole() {
+ console = new JavaStackTraceConsole();
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
+ }
}
More information about the logback-dev
mailing list