diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java index 60c138c9..43aa4ef3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java @@ -46,7 +46,6 @@ public class ExceptionUI extends JFrameConsole public static final String KONLOCH = "https://github.com/Konloch/bytecode-viewer/issues or Konloch at https://the.bytecode.club or konloch@gmail.com"; public static final String SEND_STACKTRACE_TO = buildErrorLogHeader(KONLOCH); public static final String SEND_STACKTRACE_TO_NL = SEND_STACKTRACE_TO + nl + nl; - public static int errorCounter = 1; /** * @param e The exception to be shown @@ -116,9 +115,8 @@ public class ExceptionUI extends JFrameConsole //embed error log as a new tab if(Configuration.errorLogsAsNewTab) - { - PluginManager.addExceptionUI(this, "Error #" + errorCounter++); - } + PluginManager.addExceptionUI(this); + //pop open a new window frame else { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java index bd280c2c..fe881046 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java @@ -134,6 +134,8 @@ public class JFrameConsole extends JFrame //TODO if two consoles are ran at the same time and exceed the maximum this file will be overwritten final File tempFile = new File(tempDirectory, "console_" + consoleID + ".log"); + + //TODO this needs to be rewritten, it doesn't work for a plugin that causes multiple exception UIs new Thread(()-> { //save to disk diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java index 85f52f26..e947069d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java @@ -1,6 +1,5 @@ package the.bytecode.club.bytecodeviewer.plugin; -import java.awt.*; import java.io.File; import java.util.*; import java.util.List; @@ -60,6 +59,7 @@ public final class PluginManager private static HashMap exceptionTabs = new HashMap<>(); private static int consoleCount = 0; private static int exceptionCount = 0; + private static int errorCounter = 1; static { @@ -132,7 +132,7 @@ public final class PluginManager /** * Add an active console from a plugin being ran */ - public static void addExceptionUI(ExceptionUI ui, String title) + public static void addExceptionUI(ExceptionUI ui) { if(activePlugin == null) { @@ -149,6 +149,7 @@ public final class PluginManager int id = exceptionCount++; if(activeTabbedException == null) { + String title = "Error #" + errorCounter++; activeTabbedException = new JFrameConsoleTabbed(title); if(Configuration.pluginConsoleAsNewTab)