Skip to content

Commit 932d135

Browse files
committed
Exception Tab Title Fix
1 parent 0778113 commit 932d135

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public class ExceptionUI extends JFrameConsole
4646
public static final String KONLOCH = "https://github.com/Konloch/bytecode-viewer/issues or Konloch at https://the.bytecode.club or konloch@gmail.com";
4747
public static final String SEND_STACKTRACE_TO = buildErrorLogHeader(KONLOCH);
4848
public static final String SEND_STACKTRACE_TO_NL = SEND_STACKTRACE_TO + nl + nl;
49-
public static int errorCounter = 1;
5049

5150
/**
5251
* @param e The exception to be shown
@@ -116,9 +115,8 @@ private void setupFrame(String error, String author)
116115

117116
//embed error log as a new tab
118117
if(Configuration.errorLogsAsNewTab)
119-
{
120-
PluginManager.addExceptionUI(this, "Error #" + errorCounter++);
121-
}
118+
PluginManager.addExceptionUI(this);
119+
122120
//pop open a new window frame
123121
else
124122
{

src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ public String trimConsoleText(final String s)
134134
//TODO if two consoles are ran at the same time and exceed the maximum this file will be overwritten
135135

136136
final File tempFile = new File(tempDirectory, "console_" + consoleID + ".log");
137+
138+
//TODO this needs to be rewritten, it doesn't work for a plugin that causes multiple exception UIs
137139
new Thread(()->
138140
{
139141
//save to disk

src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package the.bytecode.club.bytecodeviewer.plugin;
22

3-
import java.awt.*;
43
import java.io.File;
54
import java.util.*;
65
import java.util.List;
@@ -60,6 +59,7 @@ public final class PluginManager
6059
private static HashMap<String, ExceptionUI> exceptionTabs = new HashMap<>();
6160
private static int consoleCount = 0;
6261
private static int exceptionCount = 0;
62+
private static int errorCounter = 1;
6363

6464
static
6565
{
@@ -132,7 +132,7 @@ public static void runPlugin(File f) throws Throwable
132132
/**
133133
* Add an active console from a plugin being ran
134134
*/
135-
public static void addExceptionUI(ExceptionUI ui, String title)
135+
public static void addExceptionUI(ExceptionUI ui)
136136
{
137137
if(activePlugin == null)
138138
{
@@ -149,6 +149,7 @@ public static void addExceptionUI(ExceptionUI ui, String title)
149149
int id = exceptionCount++;
150150
if(activeTabbedException == null)
151151
{
152+
String title = "Error #" + errorCounter++;
152153
activeTabbedException = new JFrameConsoleTabbed(title);
153154

154155
if(Configuration.pluginConsoleAsNewTab)

0 commit comments

Comments
 (0)