Exception Tab Title Fix

This commit is contained in:
Konloch 2021-07-23 20:51:55 -07:00
parent 0778113726
commit 932d135ceb
3 changed files with 7 additions and 6 deletions

View file

@ -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 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 = buildErrorLogHeader(KONLOCH);
public static final String SEND_STACKTRACE_TO_NL = SEND_STACKTRACE_TO + nl + nl; 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 * @param e The exception to be shown
@ -116,9 +115,8 @@ public class ExceptionUI extends JFrameConsole
//embed error log as a new tab //embed error log as a new tab
if(Configuration.errorLogsAsNewTab) if(Configuration.errorLogsAsNewTab)
{ PluginManager.addExceptionUI(this);
PluginManager.addExceptionUI(this, "Error #" + errorCounter++);
}
//pop open a new window frame //pop open a new window frame
else else
{ {

View file

@ -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 //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"); 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(()-> new Thread(()->
{ {
//save to disk //save to disk

View file

@ -1,6 +1,5 @@
package the.bytecode.club.bytecodeviewer.plugin; package the.bytecode.club.bytecodeviewer.plugin;
import java.awt.*;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
@ -60,6 +59,7 @@ public final class PluginManager
private static HashMap<String, ExceptionUI> exceptionTabs = new HashMap<>(); private static HashMap<String, ExceptionUI> exceptionTabs = new HashMap<>();
private static int consoleCount = 0; private static int consoleCount = 0;
private static int exceptionCount = 0; private static int exceptionCount = 0;
private static int errorCounter = 1;
static static
{ {
@ -132,7 +132,7 @@ public final class PluginManager
/** /**
* Add an active console from a plugin being ran * 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) if(activePlugin == null)
{ {
@ -149,6 +149,7 @@ public final class PluginManager
int id = exceptionCount++; int id = exceptionCount++;
if(activeTabbedException == null) if(activeTabbedException == null)
{ {
String title = "Error #" + errorCounter++;
activeTabbedException = new JFrameConsoleTabbed(title); activeTabbedException = new JFrameConsoleTabbed(title);
if(Configuration.pluginConsoleAsNewTab) if(Configuration.pluginConsoleAsNewTab)