Fixed simplified tab names

This commit is contained in:
Konloch 2021-06-26 05:15:53 -07:00
parent 2314af5f7f
commit 05c6148ff5
5 changed files with 53 additions and 44 deletions

View file

@ -12,7 +12,6 @@ import java.util.List;
import java.util.Objects;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import me.konloch.kontainer.io.DiskWriter;
import me.konloch.kontainer.io.HTTPRequest;
import org.apache.commons.io.FileUtils;
import org.objectweb.asm.tree.ClassNode;
@ -72,7 +71,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
* http://the.bytecode.club
*
* TODO BUGS:
* + Tab simplified titles aren't working correctly until refreshed
* + Last selected directory isn't set on most file chooser dialogues
* + Synchronized scrolling is broken
* + Spam-clicking the refresh button will cause the swing thread to deadlock (Quickly opening resources used to also do this)
* This is caused by the ctrlMouseWheelZoom code, a temporary patch is just removing it worst case

View file

@ -7,7 +7,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.*;
@ -62,9 +61,8 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
*
* @author Konloch
*/
public class MainViewerGUI extends JFrame {
public static final long serialVersionUID = 1851409230530948543L;
public class MainViewerGUI extends JFrame
{
public AboutWindow aboutWindow = new AboutWindow();
public boolean isMaximized;
public final JMenuItem[] waitIcons;
@ -125,6 +123,7 @@ public class MainViewerGUI extends JFrame {
public final JSpinner fontSpinner = new JSpinner();
public final JMenu rstaTheme = new JMenu("Text Area Theme");
public final JMenu lafTheme = new JMenu("Window Theme");
//BCV settings
public final JCheckBoxMenuItem refreshOnChange = new JCheckBoxMenuItem("Refresh On View Change");
private final JCheckBoxMenuItem deleteForeignOutdatedLibs = new JCheckBoxMenuItem("Delete Foreign/Outdated Libs");
@ -148,9 +147,11 @@ public class MainViewerGUI extends JFrame {
public final JCheckBoxMenuItem showClassMethods = new JCheckBoxMenuItem("Show Class Methods");
public final Map<RSTATheme, JRadioButtonMenuItem> rstaThemes = new HashMap<>();
public final Map<LAFTheme, JRadioButtonMenuItem> lafThemes = new HashMap<>();
//CFIDE settings
public final JCheckBoxMenuItem appendBracketsToLabels = new JCheckBoxMenuItem("Append Brackets To Labels");
public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem("Debug Helpers");
//FernFlower settings
public final JMenu fernFlowerSettingsSecondaryMenu = new JMenu("FernFlower");
public JCheckBoxMenuItem rbr = new JCheckBoxMenuItem("Hide bridge methods");
@ -172,6 +173,7 @@ public class MainViewerGUI extends JFrame {
public JCheckBoxMenuItem fdi = new JCheckBoxMenuItem("Deinline finally structures");
public JCheckBoxMenuItem asc = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
public JCheckBoxMenuItem ren = new JCheckBoxMenuItem("Rename ambiguous classes and class elements");
//Proycon
public final JMenu procyonSettingsSecondaryMenu = new JMenu("Procyon");
public final JCheckBoxMenuItem alwaysGenerateExceptionVars = new JCheckBoxMenuItem("Always Generate Exception Variable For Catch Blocks");
@ -188,6 +190,7 @@ public class MainViewerGUI extends JFrame {
public final JCheckBoxMenuItem retainPointlessSwitches = new JCheckBoxMenuItem("Retain Pointless Switches");
public final JCheckBoxMenuItem retainRedunantCasts = new JCheckBoxMenuItem("Retain Redundant Casts");
public final JCheckBoxMenuItem unicodeOutputEnabled = new JCheckBoxMenuItem("Unicode Output Enabled");
//CFR
public final JMenu cfrSettingsSecondaryMenu = new JMenu("CFR");
public final JCheckBoxMenuItem decodeEnumSwitch = new JCheckBoxMenuItem("Decode Enum Switch");
@ -234,6 +237,7 @@ public class MainViewerGUI extends JFrame {
public final JCheckBoxMenuItem recoveryTypehInts = new JCheckBoxMenuItem("Recover Type Hints");
public final JCheckBoxMenuItem forceTurningIFs = new JCheckBoxMenuItem("Force Returning IFs");
public final JCheckBoxMenuItem forLoopAGGCapture = new JCheckBoxMenuItem("For Loop AGG Capture");
//obfuscation
public final JMenu obfuscate = new JMenu("Obfuscate");
public final JMenuItem renameFields = new JMenuItem("Rename Fields");
@ -246,36 +250,6 @@ public class MainViewerGUI extends JFrame {
public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem("Light Obfuscation");
public final JMenuItem renameClasses = new JMenuItem("Rename Classes");
public synchronized void updateBusyStatus(final boolean busy) {
SwingUtilities.invokeLater(() -> {
if (busy) {
for (int i = 0; i < 10; i++) {
if (waitIcons[i].getIcon() == null) {
try {
waitIcons[i].setIcon(Resources.busyIcon);
} catch (NullPointerException e) {
waitIcons[i].setIcon(Resources.busyB64Icon);
}
waitIcons[i].updateUI();
break;
}
}
} else {
for (int i = 0; i < 10; i++) {
if (waitIcons[i].getIcon() != null) {
waitIcons[i].setIcon(null);
waitIcons[i].updateUI();
break;
}
}
}
});
}
public void calledAfterLoad() {
deleteForeignOutdatedLibs.setSelected(Configuration.deleteForeignLibraries);
}
public MainViewerGUI()
{
setIconImages(Resources.iconList);
@ -295,7 +269,8 @@ public class MainViewerGUI extends JFrame {
defaultSettings();
waitIcons = new JMenuItem[10];
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 10; i++)
{
waitIcons[i] = new JMenuItem("");
waitIcons[i].setMaximumSize(new Dimension(20, 50));
waitIcons[i].setEnabled(false);
@ -721,12 +696,42 @@ public class MainViewerGUI extends JFrame {
appendBracketsToLabels.setSelected(true);
}
public void calledAfterLoad() {
deleteForeignOutdatedLibs.setSelected(Configuration.deleteForeignLibraries);
}
public synchronized void updateBusyStatus(final boolean busy) {
SwingUtilities.invokeLater(() -> {
if (busy) {
for (int i = 0; i < 10; i++) {
if (waitIcons[i].getIcon() == null) {
try {
waitIcons[i].setIcon(Resources.busyIcon);
} catch (NullPointerException e) {
waitIcons[i].setIcon(Resources.busyB64Icon);
}
waitIcons[i].updateUI();
break;
}
}
} else {
for (int i = 0; i < 10; i++) {
if (waitIcons[i].getIcon() != null) {
waitIcons[i].setIcon(null);
waitIcons[i].updateUI();
break;
}
}
}
});
}
public void openClassFile(final FileContainer container, final String name, final ClassNode cn) {
workPane.addWorkingFile(container, name, cn);
workPane.addClassResource(container, name, cn);
}
public void openFile(final FileContainer container, final String name, byte[] content) {
workPane.addFile(container, name, content);
workPane.addFileResource(container, name, content);
}
@SuppressWarnings("unchecked")
@ -958,4 +963,6 @@ public class MainViewerGUI extends JFrame {
Configuration.deleteForeignLibraries = deleteForeignOutdatedLibs.isSelected();
}
public static final long serialVersionUID = 1851409230530948543L;
}

View file

@ -157,7 +157,8 @@ public class WorkPaneMainComponent extends VisibleComponent
this.setVisible(true);
}
public void addWorkingFile(final FileContainer container, String name, final ClassNode cn)
//load class resources
public void addClassResource(final FileContainer container, String name, final ClassNode cn)
{
String workingName = container.name + ">" + name;
@ -172,6 +173,7 @@ public class WorkPaneMainComponent extends VisibleComponent
tabComp.tabbedPane = tabbedPane;
tabs.setTabComponentAt(tabIndex, tabbedPane);
tabs.setSelectedIndex(tabIndex);
tabComp.refreshTitle();
}
else
{
@ -179,7 +181,8 @@ public class WorkPaneMainComponent extends VisibleComponent
}
}
public void addFile(final FileContainer container, String name, byte[] contents)
//Load file resources
public void addFileResource(final FileContainer container, String name, byte[] contents)
{
if (contents == null) //a directory
return;
@ -202,6 +205,7 @@ public class WorkPaneMainComponent extends VisibleComponent
tabComp.tabbedPane = tabbedPane;
tabs.setTabComponentAt(tabIndex, tabbedPane);
tabs.setSelectedIndex(tabIndex);
tabComp.refreshTitle();
}
else
{

View file

@ -125,8 +125,6 @@ public class FileViewer extends ResourceViewer
textArea.setCaretPosition(0);
mainPanel.add(textArea.getScrollPane());
refreshTitle();
}
@Override

View file

@ -145,7 +145,8 @@ public class MiscUtils
public static int getClassNumber(String start, String ext) {
boolean b = true;
int i = 0;
while (b) {
while (b)
{
File tempF = new File(start + i + ext);
if (!tempF.exists())
b = false;