Fixed simplified tab names
This commit is contained in:
parent
2314af5f7f
commit
05c6148ff5
5 changed files with 53 additions and 44 deletions
|
@ -12,7 +12,6 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import me.konloch.kontainer.io.DiskWriter;
|
|
||||||
import me.konloch.kontainer.io.HTTPRequest;
|
import me.konloch.kontainer.io.HTTPRequest;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
@ -72,7 +71,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
|
||||||
* http://the.bytecode.club
|
* http://the.bytecode.club
|
||||||
*
|
*
|
||||||
* TODO BUGS:
|
* 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
|
* + Synchronized scrolling is broken
|
||||||
* + Spam-clicking the refresh button will cause the swing thread to deadlock (Quickly opening resources used to also do this)
|
* + 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
|
* This is caused by the ctrlMouseWheelZoom code, a temporary patch is just removing it worst case
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.filechooser.FileFilter;
|
|
||||||
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.*;
|
import the.bytecode.club.bytecodeviewer.*;
|
||||||
|
@ -62,9 +61,8 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
|
||||||
*
|
*
|
||||||
* @author Konloch
|
* @author Konloch
|
||||||
*/
|
*/
|
||||||
public class MainViewerGUI extends JFrame {
|
public class MainViewerGUI extends JFrame
|
||||||
|
{
|
||||||
public static final long serialVersionUID = 1851409230530948543L;
|
|
||||||
public AboutWindow aboutWindow = new AboutWindow();
|
public AboutWindow aboutWindow = new AboutWindow();
|
||||||
public boolean isMaximized;
|
public boolean isMaximized;
|
||||||
public final JMenuItem[] waitIcons;
|
public final JMenuItem[] waitIcons;
|
||||||
|
@ -125,6 +123,7 @@ public class MainViewerGUI extends JFrame {
|
||||||
public final JSpinner fontSpinner = new JSpinner();
|
public final JSpinner fontSpinner = new JSpinner();
|
||||||
public final JMenu rstaTheme = new JMenu("Text Area Theme");
|
public final JMenu rstaTheme = new JMenu("Text Area Theme");
|
||||||
public final JMenu lafTheme = new JMenu("Window Theme");
|
public final JMenu lafTheme = new JMenu("Window Theme");
|
||||||
|
|
||||||
//BCV settings
|
//BCV settings
|
||||||
public final JCheckBoxMenuItem refreshOnChange = new JCheckBoxMenuItem("Refresh On View Change");
|
public final JCheckBoxMenuItem refreshOnChange = new JCheckBoxMenuItem("Refresh On View Change");
|
||||||
private final JCheckBoxMenuItem deleteForeignOutdatedLibs = new JCheckBoxMenuItem("Delete Foreign/Outdated Libs");
|
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 JCheckBoxMenuItem showClassMethods = new JCheckBoxMenuItem("Show Class Methods");
|
||||||
public final Map<RSTATheme, JRadioButtonMenuItem> rstaThemes = new HashMap<>();
|
public final Map<RSTATheme, JRadioButtonMenuItem> rstaThemes = new HashMap<>();
|
||||||
public final Map<LAFTheme, JRadioButtonMenuItem> lafThemes = new HashMap<>();
|
public final Map<LAFTheme, JRadioButtonMenuItem> lafThemes = new HashMap<>();
|
||||||
|
|
||||||
//CFIDE settings
|
//CFIDE settings
|
||||||
public final JCheckBoxMenuItem appendBracketsToLabels = new JCheckBoxMenuItem("Append Brackets To Labels");
|
public final JCheckBoxMenuItem appendBracketsToLabels = new JCheckBoxMenuItem("Append Brackets To Labels");
|
||||||
public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem("Debug Helpers");
|
public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem("Debug Helpers");
|
||||||
|
|
||||||
//FernFlower settings
|
//FernFlower settings
|
||||||
public final JMenu fernFlowerSettingsSecondaryMenu = new JMenu("FernFlower");
|
public final JMenu fernFlowerSettingsSecondaryMenu = new JMenu("FernFlower");
|
||||||
public JCheckBoxMenuItem rbr = new JCheckBoxMenuItem("Hide bridge methods");
|
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 fdi = new JCheckBoxMenuItem("Deinline finally structures");
|
||||||
public JCheckBoxMenuItem asc = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
|
public JCheckBoxMenuItem asc = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
|
||||||
public JCheckBoxMenuItem ren = new JCheckBoxMenuItem("Rename ambiguous classes and class elements");
|
public JCheckBoxMenuItem ren = new JCheckBoxMenuItem("Rename ambiguous classes and class elements");
|
||||||
|
|
||||||
//Proycon
|
//Proycon
|
||||||
public final JMenu procyonSettingsSecondaryMenu = new JMenu("Procyon");
|
public final JMenu procyonSettingsSecondaryMenu = new JMenu("Procyon");
|
||||||
public final JCheckBoxMenuItem alwaysGenerateExceptionVars = new JCheckBoxMenuItem("Always Generate Exception Variable For Catch Blocks");
|
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 retainPointlessSwitches = new JCheckBoxMenuItem("Retain Pointless Switches");
|
||||||
public final JCheckBoxMenuItem retainRedunantCasts = new JCheckBoxMenuItem("Retain Redundant Casts");
|
public final JCheckBoxMenuItem retainRedunantCasts = new JCheckBoxMenuItem("Retain Redundant Casts");
|
||||||
public final JCheckBoxMenuItem unicodeOutputEnabled = new JCheckBoxMenuItem("Unicode Output Enabled");
|
public final JCheckBoxMenuItem unicodeOutputEnabled = new JCheckBoxMenuItem("Unicode Output Enabled");
|
||||||
|
|
||||||
//CFR
|
//CFR
|
||||||
public final JMenu cfrSettingsSecondaryMenu = new JMenu("CFR");
|
public final JMenu cfrSettingsSecondaryMenu = new JMenu("CFR");
|
||||||
public final JCheckBoxMenuItem decodeEnumSwitch = new JCheckBoxMenuItem("Decode Enum Switch");
|
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 recoveryTypehInts = new JCheckBoxMenuItem("Recover Type Hints");
|
||||||
public final JCheckBoxMenuItem forceTurningIFs = new JCheckBoxMenuItem("Force Returning IFs");
|
public final JCheckBoxMenuItem forceTurningIFs = new JCheckBoxMenuItem("Force Returning IFs");
|
||||||
public final JCheckBoxMenuItem forLoopAGGCapture = new JCheckBoxMenuItem("For Loop AGG Capture");
|
public final JCheckBoxMenuItem forLoopAGGCapture = new JCheckBoxMenuItem("For Loop AGG Capture");
|
||||||
|
|
||||||
//obfuscation
|
//obfuscation
|
||||||
public final JMenu obfuscate = new JMenu("Obfuscate");
|
public final JMenu obfuscate = new JMenu("Obfuscate");
|
||||||
public final JMenuItem renameFields = new JMenuItem("Rename Fields");
|
public final JMenuItem renameFields = new JMenuItem("Rename Fields");
|
||||||
|
@ -245,36 +249,6 @@ public class MainViewerGUI extends JFrame {
|
||||||
public final JRadioButtonMenuItem strongObf = new JRadioButtonMenuItem("Strong Obfuscation");
|
public final JRadioButtonMenuItem strongObf = new JRadioButtonMenuItem("Strong Obfuscation");
|
||||||
public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem("Light Obfuscation");
|
public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem("Light Obfuscation");
|
||||||
public final JMenuItem renameClasses = new JMenuItem("Rename Classes");
|
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()
|
public MainViewerGUI()
|
||||||
{
|
{
|
||||||
|
@ -295,7 +269,8 @@ public class MainViewerGUI extends JFrame {
|
||||||
defaultSettings();
|
defaultSettings();
|
||||||
|
|
||||||
waitIcons = new JMenuItem[10];
|
waitIcons = new JMenuItem[10];
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
waitIcons[i] = new JMenuItem("");
|
waitIcons[i] = new JMenuItem("");
|
||||||
waitIcons[i].setMaximumSize(new Dimension(20, 50));
|
waitIcons[i].setMaximumSize(new Dimension(20, 50));
|
||||||
waitIcons[i].setEnabled(false);
|
waitIcons[i].setEnabled(false);
|
||||||
|
@ -720,13 +695,43 @@ public class MainViewerGUI extends JFrame {
|
||||||
debugHelpers.setSelected(true);
|
debugHelpers.setSelected(true);
|
||||||
appendBracketsToLabels.setSelected(true);
|
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) {
|
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) {
|
public void openFile(final FileContainer container, final String name, byte[] content) {
|
||||||
workPane.addFile(container, name, content);
|
workPane.addFileResource(container, name, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -958,4 +963,6 @@ public class MainViewerGUI extends JFrame {
|
||||||
|
|
||||||
Configuration.deleteForeignLibraries = deleteForeignOutdatedLibs.isSelected();
|
Configuration.deleteForeignLibraries = deleteForeignOutdatedLibs.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final long serialVersionUID = 1851409230530948543L;
|
||||||
}
|
}
|
|
@ -157,7 +157,8 @@ public class WorkPaneMainComponent extends VisibleComponent
|
||||||
this.setVisible(true);
|
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;
|
String workingName = container.name + ">" + name;
|
||||||
|
|
||||||
|
@ -172,6 +173,7 @@ public class WorkPaneMainComponent extends VisibleComponent
|
||||||
tabComp.tabbedPane = tabbedPane;
|
tabComp.tabbedPane = tabbedPane;
|
||||||
tabs.setTabComponentAt(tabIndex, tabbedPane);
|
tabs.setTabComponentAt(tabIndex, tabbedPane);
|
||||||
tabs.setSelectedIndex(tabIndex);
|
tabs.setSelectedIndex(tabIndex);
|
||||||
|
tabComp.refreshTitle();
|
||||||
}
|
}
|
||||||
else
|
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
|
if (contents == null) //a directory
|
||||||
return;
|
return;
|
||||||
|
@ -202,6 +205,7 @@ public class WorkPaneMainComponent extends VisibleComponent
|
||||||
tabComp.tabbedPane = tabbedPane;
|
tabComp.tabbedPane = tabbedPane;
|
||||||
tabs.setTabComponentAt(tabIndex, tabbedPane);
|
tabs.setTabComponentAt(tabIndex, tabbedPane);
|
||||||
tabs.setSelectedIndex(tabIndex);
|
tabs.setSelectedIndex(tabIndex);
|
||||||
|
tabComp.refreshTitle();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,8 +125,6 @@ public class FileViewer extends ResourceViewer
|
||||||
textArea.setCaretPosition(0);
|
textArea.setCaretPosition(0);
|
||||||
|
|
||||||
mainPanel.add(textArea.getScrollPane());
|
mainPanel.add(textArea.getScrollPane());
|
||||||
|
|
||||||
refreshTitle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -145,7 +145,8 @@ public class MiscUtils
|
||||||
public static int getClassNumber(String start, String ext) {
|
public static int getClassNumber(String start, String ext) {
|
||||||
boolean b = true;
|
boolean b = true;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (b) {
|
while (b)
|
||||||
|
{
|
||||||
File tempF = new File(start + i + ext);
|
File tempF = new File(start + i + ext);
|
||||||
if (!tempF.exists())
|
if (!tempF.exists())
|
||||||
b = false;
|
b = false;
|
||||||
|
|
Loading…
Reference in a new issue