GUI Code Cleanup

This commit is contained in:
Konloch 2021-06-21 16:37:55 -07:00
parent 784eb1921a
commit c940bf5c8d
29 changed files with 177 additions and 261 deletions

View file

@ -26,9 +26,9 @@ import the.bytecode.club.bytecodeviewer.compilers.Compilers;
import the.bytecode.club.bytecodeviewer.gui.ClassViewer; import the.bytecode.club.bytecodeviewer.gui.ClassViewer;
import the.bytecode.club.bytecodeviewer.gui.ResourceListPane; import the.bytecode.club.bytecodeviewer.gui.ResourceListPane;
import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI; import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI;
import the.bytecode.club.bytecodeviewer.gui.RunOptions; import the.bytecode.club.bytecodeviewer.gui.extras.RunOptions;
import the.bytecode.club.bytecodeviewer.gui.SearchBoxPane; import the.bytecode.club.bytecodeviewer.gui.SearchBoxPane;
import the.bytecode.club.bytecodeviewer.gui.SystemErrConsole; import the.bytecode.club.bytecodeviewer.gui.extras.SystemErrConsole;
import the.bytecode.club.bytecodeviewer.gui.WorkPane; import the.bytecode.club.bytecodeviewer.gui.WorkPane;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer; import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer;
import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
@ -374,7 +374,7 @@ public class BytecodeViewer
* @return true if no errors, false if it failed to compile. * @return true if no errors, false if it failed to compile.
*/ */
public static boolean compile(boolean message) { public static boolean compile(boolean message) {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
boolean actuallyTried = false; boolean actuallyTried = false;
for (java.awt.Component c : BytecodeViewer.viewer.workPane.getLoadedViewers()) { for (java.awt.Component c : BytecodeViewer.viewer.workPane.getLoadedViewers()) {
@ -401,7 +401,7 @@ public class BytecodeViewer
} else { } else {
BytecodeViewer.showMessage("There has been an error with assembling your Smali code, " BytecodeViewer.showMessage("There has been an error with assembling your Smali code, "
+ "please check this. Class: " + origNode.name); + "please check this. Class: " + origNode.name);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
return false; return false;
} }
} }
@ -429,7 +429,7 @@ public class BytecodeViewer
} else { } else {
BytecodeViewer.showMessage("There has been an error with assembling your Krakatau " BytecodeViewer.showMessage("There has been an error with assembling your Krakatau "
+ "Bytecode, please check this. Class: " + origNode.name); + "Bytecode, please check this. Class: " + origNode.name);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
return false; return false;
} }
} }
@ -463,7 +463,7 @@ public class BytecodeViewer
errConsole.pretty(); errConsole.pretty();
errConsole.setVisible(true); errConsole.setVisible(true);
errConsole.finished(); errConsole.finished();
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
return false; return false;
} }
} }
@ -477,7 +477,7 @@ public class BytecodeViewer
else else
BytecodeViewer.showMessage("You have no editable panes opened, make one editable and try again."); BytecodeViewer.showMessage("You have no editable panes opened, make one editable and try again.");
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
return true; return true;
} }
@ -493,7 +493,7 @@ public class BytecodeViewer
if (f.exists()) if (f.exists())
BytecodeViewer.addRecentFile(f); BytecodeViewer.addRecentFile(f);
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Configuration.needsReDump = true; Configuration.needsReDump = true;
Thread t = new Thread(new OpenFile(files)); Thread t = new Thread(new OpenFile(files));
t.start(); t.start();
@ -698,9 +698,9 @@ public class BytecodeViewer
if (returnVal == JFileChooser.APPROVE_OPTION) { if (returnVal == JFileChooser.APPROVE_OPTION) {
Configuration.lastDirectory = fc.getSelectedFile().getAbsolutePath(); Configuration.lastDirectory = fc.getSelectedFile().getAbsolutePath();
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()}, true); BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()}, true);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e1) { } catch (Exception e1) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
} }
@ -773,11 +773,11 @@ public class BytecodeViewer
final File file2 = file; final File file2 = file;
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Thread t1 = new Thread(() -> { Thread t1 = new Thread(() -> {
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
file2.getAbsolutePath()); file2.getAbsolutePath());
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
}); });
t1.start(); t1.start();
} }

View file

@ -184,7 +184,7 @@ public class BytecodeViewer {
* @param busy if it should display the busy icon or not * @param busy if it should display the busy icon or not
*/ */
public static void setBusy(boolean busy) { public static void setBusy(boolean busy) {
the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer.setIcon(busy); the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer.updateBusyStatus(busy);
} }
/** /**

View file

@ -32,7 +32,7 @@ public abstract class Plugin extends Thread {
@Override @Override
public void run() { public void run() {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
try { try {
if (BytecodeViewer.getLoadedClasses().isEmpty()) { if (BytecodeViewer.getLoadedClasses().isEmpty()) {
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
@ -43,7 +43,7 @@ public abstract class Plugin extends Thread {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
} finally { } finally {
finished = true; finished = true;
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} }
} }

View file

@ -1,6 +1,6 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui;
import com.jhe.hexed.JHexEditor; import the.bytecode.club.bytecodeviewer.gui.hexviewer.JHexEditor;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -460,7 +460,7 @@ public class ClassViewer extends Viewer {
viewer = THIS; viewer = THIS;
decompiler = pane1; decompiler = pane1;
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
if (pane1 == 1) { // procyon if (pane1 == 1) { // procyon
panelArea = new RSyntaxTextArea(); panelArea = new RSyntaxTextArea();
panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
@ -834,7 +834,7 @@ public class ClassViewer extends Viewer {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
} finally { } finally {
resetDivider(); resetDivider();
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
if (button != null) if (button != null)
button.setEnabled(true); button.setEnabled(true);
} }
@ -850,7 +850,7 @@ public class ClassViewer extends Viewer {
viewer = THIS; viewer = THIS;
decompiler = pane2; decompiler = pane2;
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
if (pane2 == 1) { if (pane2 == 1) {
panelArea = new RSyntaxTextArea(); panelArea = new RSyntaxTextArea();
panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
@ -1223,7 +1223,7 @@ public class ClassViewer extends Viewer {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
} finally { } finally {
resetDivider(); resetDivider();
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
if (button != null) if (button != null)
button.setEnabled(true); button.setEnabled(true);
} }
@ -1239,7 +1239,7 @@ public class ClassViewer extends Viewer {
viewer = THIS; viewer = THIS;
decompiler = pane3; decompiler = pane3;
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
if (pane3 == 1) { if (pane3 == 1) {
panelArea = new RSyntaxTextArea(); panelArea = new RSyntaxTextArea();
panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); panelArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
@ -1612,7 +1612,7 @@ public class ClassViewer extends Viewer {
//new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); //new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
} finally { } finally {
resetDivider(); resetDivider();
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
if (button != null) if (button != null)
button.setEnabled(true); button.setEnabled(true);
} }
@ -1620,7 +1620,7 @@ public class ClassViewer extends Viewer {
}; };
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
while (Configuration.currentlyDumping) { while (Configuration.currentlyDumping) {
//wait until it's not dumping //wait until it's not dumping
try { try {
@ -1631,7 +1631,7 @@ public class ClassViewer extends Viewer {
} }
tempFiles = BytecodeViewer.dumpTempFile(container); tempFiles = BytecodeViewer.dumpTempFile(container);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
if (pane1 > 0) if (pane1 > 0)
t1.start(); t1.start();

View file

@ -1,6 +1,6 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui;
import com.jhe.hexed.JHexEditor; import the.bytecode.club.bytecodeviewer.gui.hexviewer.JHexEditor;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;

View file

@ -28,6 +28,10 @@ import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.Settings; import the.bytecode.club.bytecodeviewer.Settings;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.gui.extras.AboutWindow;
import the.bytecode.club.bytecodeviewer.gui.extras.RunOptions;
import the.bytecode.club.bytecodeviewer.gui.plugins.MaliciousCodeScannerOptions;
import the.bytecode.club.bytecodeviewer.gui.plugins.ReplaceStringsOptions;
import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameClasses; import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameClasses;
import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameFields; import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameFields;
import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameMethods; import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameMethods;
@ -66,17 +70,20 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
* *
* @author Konloch * @author Konloch
*/ */
public class MainViewerGUI extends JFrame implements FileChangeNotifier { public class MainViewerGUI extends JFrame {
public static final long serialVersionUID = 1851409230530948543L; public static final long serialVersionUID = 1851409230530948543L;
private static final ArrayList<VisibleComponent> uiComponents = new ArrayList<>();
public AboutWindow aboutWindow = new AboutWindow(); public AboutWindow aboutWindow = new AboutWindow();
public ResourceListPane resourcePane = new ResourceListPane(this);
public SearchBoxPane searchBoxPane;
public boolean isMaximized; public boolean isMaximized;
public final JMenuItem[] waitIcons;
//main UI components
private static final ArrayList<VisibleComponent> uiComponents = new ArrayList<>();
public final WorkPane workPane = new WorkPane();
public final ResourceListPane resourcePane = new ResourceListPane();
public final SearchBoxPane searchBoxPane = new SearchBoxPane();
public JSplitPane splitPane1; public JSplitPane splitPane1;
public JSplitPane splitPane2; public JSplitPane splitPane2;
public final JMenuItem[] waitIcons;
//the root menu bar //the root menu bar
public final JMenuBar rootMenu = new JMenuBar(); public final JMenuBar rootMenu = new JMenuBar();
@ -119,12 +126,31 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final JMenuItem zStringArrayDecrypter = new JMenuItem("ZStringArray Decrypter"); public final JMenuItem zStringArrayDecrypter = new JMenuItem("ZStringArray Decrypter");
//all of the settings main menu components //all of the settings main menu components
private final JCheckBoxMenuItem deleteForeignOutdatedLibs = new JCheckBoxMenuItem("Delete Foreign/Outdated Libs");
public final ButtonGroup apkConversionGroup = new ButtonGroup(); public final ButtonGroup apkConversionGroup = new ButtonGroup();
public final JRadioButtonMenuItem apkConversionDex = new JRadioButtonMenuItem("Dex2Jar"); public final JRadioButtonMenuItem apkConversionDex = new JRadioButtonMenuItem("Dex2Jar");
public final JRadioButtonMenuItem apkConversionEnjarify = new JRadioButtonMenuItem("Enjarify"); public final JRadioButtonMenuItem apkConversionEnjarify = new JRadioButtonMenuItem("Enjarify");
public final JMenu fontSize = new JMenu("Font Size"); public final JMenu fontSize = new JMenu("Font Size");
public final JSpinner fontSpinner = new JSpinner(); public final JSpinner fontSpinner = new JSpinner();
//BCV settings
public final JCheckBoxMenuItem refreshOnChange = new JCheckBoxMenuItem("Refresh On View Change");
private final JCheckBoxMenuItem deleteForeignOutdatedLibs = new JCheckBoxMenuItem("Delete Foreign/Outdated Libs");
public final JMenu settingsMainMenu = new JMenu("Settings");
public final JMenu visualSettings = new JMenu("Visual Settings");
public final JMenu apkConversion = new JMenu("APK Conversion");
public final JMenu bytecodeDecompilerSettingsSecondaryMenu = new JMenu("Bytecode Decompiler");
public final JCheckBoxMenuItem updateCheck = new JCheckBoxMenuItem("Update Check");
public final JMenuItem setPython2 = new JMenuItem("Set Python 2.7 Executable");
public final JMenuItem setPython3 = new JMenuItem("Set Python 3.X Executable");
public final JMenuItem setJRERT = new JMenuItem("Set JRE RT Library");
public final JMenuItem setJavac = new JMenuItem("Set Javac Executable");
public final JMenuItem setOptionalLibrary = new JMenuItem("Set Optional Library Folder");
public final JCheckBoxMenuItem compileOnSave = new JCheckBoxMenuItem("Compile On Save");
public final JCheckBoxMenuItem showFileInTabTitle = new JCheckBoxMenuItem("Show File In Tab Title");
public final JCheckBoxMenuItem forcePureAsciiAsText = new JCheckBoxMenuItem("Force Pure Ascii As Text");
public final JCheckBoxMenuItem autoCompileOnRefresh = new JCheckBoxMenuItem("Compile On Refresh");
public final JCheckBoxMenuItem decodeAPKResources = new JCheckBoxMenuItem("Decode APK Resources");
public final JCheckBoxMenuItem synchronizedViewing = new JCheckBoxMenuItem("Synchronized Viewing");
public final JCheckBoxMenuItem showClassMethods = new JCheckBoxMenuItem("Show Class Methods");
//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");
@ -161,6 +187,10 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final JCheckBoxMenuItem mergeVariables = new JCheckBoxMenuItem("Merge Variables"); public final JCheckBoxMenuItem mergeVariables = new JCheckBoxMenuItem("Merge Variables");
public final JCheckBoxMenuItem forceExplicitTypeArguments = new JCheckBoxMenuItem("Force Explicit Type Arguments"); public final JCheckBoxMenuItem forceExplicitTypeArguments = new JCheckBoxMenuItem("Force Explicit Type Arguments");
public final JCheckBoxMenuItem forceExplicitImports = new JCheckBoxMenuItem("Force Explicit Imports"); public final JCheckBoxMenuItem forceExplicitImports = new JCheckBoxMenuItem("Force Explicit Imports");
public final JCheckBoxMenuItem flattenSwitchBlocks = new JCheckBoxMenuItem("Flatten Switch Blocks");
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 //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");
@ -186,6 +216,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final JCheckBoxMenuItem comments = new JCheckBoxMenuItem("Comments"); public final JCheckBoxMenuItem comments = new JCheckBoxMenuItem("Comments");
public final JCheckBoxMenuItem forceTopSort = new JCheckBoxMenuItem("Force Top Sort"); public final JCheckBoxMenuItem forceTopSort = new JCheckBoxMenuItem("Force Top Sort");
public final JCheckBoxMenuItem forceTopSortAggress = new JCheckBoxMenuItem("Force Top Sort Aggress"); public final JCheckBoxMenuItem forceTopSortAggress = new JCheckBoxMenuItem("Force Top Sort Aggress");
public final JCheckBoxMenuItem forceExceptionPrune = new JCheckBoxMenuItem("Force Exception Prune");
public final JCheckBoxMenuItem stringBuffer = new JCheckBoxMenuItem("String Buffer"); public final JCheckBoxMenuItem stringBuffer = new JCheckBoxMenuItem("String Buffer");
public final JCheckBoxMenuItem stringBuilder = new JCheckBoxMenuItem("String Builder"); public final JCheckBoxMenuItem stringBuilder = new JCheckBoxMenuItem("String Builder");
public final JCheckBoxMenuItem silent = new JCheckBoxMenuItem("Silent"); public final JCheckBoxMenuItem silent = new JCheckBoxMenuItem("Silent");
@ -206,12 +237,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
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");
public final JCheckBoxMenuItem forceExceptionPrune = new JCheckBoxMenuItem("Force Exception Prune"); //obfuscation
public final JCheckBoxMenuItem unicodeOutputEnabled = new JCheckBoxMenuItem("Unicode Output Enabled");
public final JCheckBoxMenuItem retainPointlessSwitches = new JCheckBoxMenuItem("Retain Pointless Switches");
public final JCheckBoxMenuItem retainRedunantCasts = new JCheckBoxMenuItem("Retain Redundant Casts");
public final JCheckBoxMenuItem flattenSwitchBlocks = new JCheckBoxMenuItem("Flatten Switch Blocks");
public final JCheckBoxMenuItem updateCheck = new JCheckBoxMenuItem("Update Check");
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");
public final JMenuItem renameMethods = new JMenuItem("Rename Methods"); public final JMenuItem renameMethods = new JMenuItem("Rename Methods");
@ -222,24 +248,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
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 final JMenu settingsMainMenu = new JMenu("Settings");
public final JCheckBoxMenuItem compileOnSave = new JCheckBoxMenuItem("Compile On Save");
public final JCheckBoxMenuItem showFileInTabTitle = new JCheckBoxMenuItem("Show File In Tab Title");
public final JCheckBoxMenuItem forcePureAsciiAsText = new JCheckBoxMenuItem("Force Pure Ascii As Text");
public final JCheckBoxMenuItem autoCompileOnRefresh = new JCheckBoxMenuItem("Compile On Refresh");
public final JMenuItem setPython2 = new JMenuItem("Set Python 2.7 Executable");
public final JMenuItem setJRERT = new JMenuItem("Set JRE RT Library");
public final JCheckBoxMenuItem decodeAPKResources = new JCheckBoxMenuItem("Decode APK Resources");
public final JCheckBoxMenuItem synchronizedViewing = new JCheckBoxMenuItem("Synchronized Viewing");
public final JCheckBoxMenuItem showClassMethods = new JCheckBoxMenuItem("Show Class Methods");
public final JMenu visualSettings = new JMenu("Visual Settings");
public final JMenu apkConversion = new JMenu("APK Conversion");
public final JMenuItem setPython3 = new JMenuItem("Set Python 3.X Executable");
public final JMenuItem setOptionalLibrary = new JMenuItem("Set Optional Library Folder");
public final JMenuItem setJavac = new JMenuItem("Set Javac Executable");
public final JMenu bytecodeDecompilerSettingsSecondaryMenu = new JMenu("Bytecode Decompiler");
public synchronized void setIcon(final boolean busy) { public synchronized void updateBusyStatus(final boolean busy) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
if (busy) { if (busy) {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -269,9 +279,6 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
deleteForeignOutdatedLibs.setSelected(Configuration.deleteForeignLibraries); deleteForeignOutdatedLibs.setSelected(Configuration.deleteForeignLibraries);
} }
public final JCheckBoxMenuItem refreshOnChange = new JCheckBoxMenuItem("Refresh On View Change");
public final WorkPane workPane = new WorkPane(this);
public MainViewerGUI() public MainViewerGUI()
{ {
setIconImages(Resources.iconList); setIconImages(Resources.iconList);
@ -302,24 +309,21 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS)); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));
// scrollPane.setViewportView(tree);
resourcePane.setMinimumSize(new Dimension(200, 50)); resourcePane.setMinimumSize(new Dimension(200, 50));
// panel.add(cn); resourcePane.setPreferredSize(new Dimension(200, 50));
searchBoxPane = new SearchBoxPane(this); resourcePane.setMaximumSize(new Dimension(200, 2147483647));
searchBoxPane.setPreferredSize(new Dimension(200, 50)); searchBoxPane.setPreferredSize(new Dimension(200, 50));
searchBoxPane.setMinimumSize(new Dimension(200, 50)); searchBoxPane.setMinimumSize(new Dimension(200, 50));
searchBoxPane.setMaximumSize(new Dimension(200, 2147483647)); searchBoxPane.setMaximumSize(new Dimension(200, 2147483647));
// panel.add(s);
splitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, resourcePane, searchBoxPane); splitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, resourcePane, searchBoxPane);
// panel.add(sp1);
resourcePane.setPreferredSize(new Dimension(200, 50));
resourcePane.setMaximumSize(new Dimension(200, 2147483647));
splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitPane1, workPane); splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitPane1, workPane);
getContentPane().add(splitPane2); getContentPane().add(splitPane2);
splitPane2.setResizeWeight(0.05); splitPane2.setResizeWeight(0.05);
splitPane1.setResizeWeight(0.5); splitPane1.setResizeWeight(0.5);
uiComponents.add(resourcePane);
uiComponents.add(resourcePane);
uiComponents.add(searchBoxPane); uiComponents.add(searchBoxPane);
uiComponents.add(workPane); uiComponents.add(workPane);
@ -667,18 +671,12 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
appendBracketsToLabels.setSelected(true); appendBracketsToLabels.setSelected(true);
} }
@Override
public void openClassFile(final FileContainer container, final String name, final ClassNode cn) { public void openClassFile(final FileContainer container, final String name, final ClassNode cn) {
for (final VisibleComponent vc : uiComponents) { workPane.addWorkingFile(container, name, cn);
vc.openClassFile(container, name, cn);
}
} }
@Override
public void openFile(final FileContainer container, final String name, byte[] content) { public void openFile(final FileContainer container, final String name, byte[] content) {
for (final VisibleComponent vc : uiComponents) { workPane.addFile(container, name, content);
vc.openFile(container, name, content);
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -729,9 +727,9 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
if (returnVal == JFileChooser.APPROVE_OPTION) { if (returnVal == JFileChooser.APPROVE_OPTION) {
Configuration.lastDirectory = fc.getSelectedFile().getAbsolutePath(); Configuration.lastDirectory = fc.getSelectedFile().getAbsolutePath();
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()}, true); BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()}, true);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e1) { } catch (Exception e1) {
new ExceptionUI(e1); new ExceptionUI(e1);
} }
@ -962,9 +960,9 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
if (returnVal == JFileChooser.APPROVE_OPTION) if (returnVal == JFileChooser.APPROVE_OPTION)
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
BytecodeViewer.startPlugin(fc.getSelectedFile()); BytecodeViewer.startPlugin(fc.getSelectedFile());
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e1) { } catch (Exception e1) {
new ExceptionUI(e1); new ExceptionUI(e1);
} }
@ -990,5 +988,4 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
System.exit(0); System.exit(0);
} }
} }
} }

View file

@ -40,7 +40,6 @@ import javax.swing.tree.TreePath;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.util.FileChangeNotifier;
import the.bytecode.club.bytecodeviewer.util.FileContainer; import the.bytecode.club.bytecodeviewer.util.FileContainer;
import the.bytecode.club.bytecodeviewer.util.FileDrop; import the.bytecode.club.bytecodeviewer.util.FileDrop;
import the.bytecode.club.bytecodeviewer.util.LazyNameUtil; import the.bytecode.club.bytecodeviewer.util.LazyNameUtil;
@ -71,10 +70,8 @@ import the.bytecode.club.bytecodeviewer.util.LazyNameUtil;
* @author afffsdd * @author afffsdd
*/ */
public class ResourceListPane extends VisibleComponent implements public class ResourceListPane extends VisibleComponent implements FileDrop.Listener
FileDrop.Listener { {
FileChangeNotifier fcn;
JCheckBox exact = new JCheckBox("Exact"); JCheckBox exact = new JCheckBox("Exact");
JButton open = new JButton("+"); JButton open = new JButton("+");
JButton close = new JButton("-"); JButton close = new JButton("-");
@ -245,9 +242,8 @@ public class ResourceListPane extends VisibleComponent implements
LazyNameUtil.removeName(fileContainer.name); LazyNameUtil.removeName(fileContainer.name);
} }
public ResourceListPane(final FileChangeNotifier fcn) { public ResourceListPane() {
super("ClassNavigation"); super("ClassNavigation");
this.fcn = fcn;
tree.setRootVisible(false); tree.setRootVisible(false);
tree.setShowsRootHandles(true); tree.setShowsRootHandles(true);
quickSearch.setForeground(Color.gray); quickSearch.setForeground(Color.gray);
@ -374,11 +370,11 @@ public class ResourceListPane extends VisibleComponent implements
} }
public void openClassFileToWorkSpace(final FileContainer container, final String name, final ClassNode node) { public void openClassFileToWorkSpace(final FileContainer container, final String name, final ClassNode node) {
fcn.openClassFile(container, name, node); BytecodeViewer.viewer.openClassFile(container, name, node);
} }
public void openFileToWorkSpace(final FileContainer container, String name, byte[] contents) { public void openFileToWorkSpace(final FileContainer container, String name, byte[] contents) {
fcn.openFile(container, name, contents); BytecodeViewer.viewer.openFile(container, name, contents);
} }
@Override @Override

View file

@ -26,7 +26,6 @@ import the.bytecode.club.bytecodeviewer.searching.RegexInsnFinder;
import the.bytecode.club.bytecodeviewer.searching.RegexSearch; import the.bytecode.club.bytecodeviewer.searching.RegexSearch;
import the.bytecode.club.bytecodeviewer.searching.SearchResultNotifier; import the.bytecode.club.bytecodeviewer.searching.SearchResultNotifier;
import the.bytecode.club.bytecodeviewer.searching.SearchTypeDetails; import the.bytecode.club.bytecodeviewer.searching.SearchTypeDetails;
import the.bytecode.club.bytecodeviewer.util.FileChangeNotifier;
import the.bytecode.club.bytecodeviewer.util.FileContainer; import the.bytecode.club.bytecodeviewer.util.FileContainer;
/*************************************************************************** /***************************************************************************
@ -61,8 +60,6 @@ public class SearchBoxPane extends VisibleComponent {
public static final SearchRadius[] SEARCH_RADII = SearchRadius.values(); public static final SearchRadius[] SEARCH_RADII = SearchRadius.values();
public static final SearchType[] SEARCH_TYPES = SearchType.values(); public static final SearchType[] SEARCH_TYPES = SearchType.values();
FileChangeNotifier fcn;
JCheckBox exact = new JCheckBox("Exact"); JCheckBox exact = new JCheckBox("Exact");
DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("Results"); DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("Results");
JTree tree; JTree tree;
@ -81,11 +78,9 @@ public class SearchBoxPane extends VisibleComponent {
}; };
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public SearchBoxPane(final FileChangeNotifier fcn) { public SearchBoxPane() {
super("Search"); super("Search");
this.fcn = fcn;
final JPanel optionPanel = new JPanel(new BorderLayout()); final JPanel optionPanel = new JPanel(new BorderLayout());
final JPanel searchRadiusOpt = new JPanel(new BorderLayout()); final JPanel searchRadiusOpt = new JPanel(new BorderLayout());
@ -186,8 +181,7 @@ public class SearchBoxPane extends VisibleComponent {
public void doSearch() { public void doSearch() {
try { try {
Pattern.compile(RegexInsnFinder.processRegex(RegexSearch.searchText.getText()), Pattern.compile(RegexInsnFinder.processRegex(RegexSearch.searchText.getText()), Pattern.MULTILINE);
Pattern.MULTILINE);
} catch (PatternSyntaxException ex) { } catch (PatternSyntaxException ex) {
BytecodeViewer.showMessage("You have an error in your regex syntax."); BytecodeViewer.showMessage("You have an error in your regex syntax.");
} }
@ -196,23 +190,23 @@ public class SearchBoxPane extends VisibleComponent {
for (ClassNode c : container.classes) for (ClassNode c : container.classes)
searchType.details.search(container, c, srn, exact.isSelected()); searchType.details.search(container, c, srn, exact.isSelected());
Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class)).search.setEnabled(true); Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class))
Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class)).search.setText( .search.setEnabled(true);
"Search"); Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class))
.search.setText("Search");
tree.expandPath(new TreePath(tree.getModel().getRoot())); tree.expandPath(new TreePath(tree.getModel().getRoot()));
tree.updateUI(); tree.updateUI();
} }
}; };
Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class)).search Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class))
.setEnabled(false); .search.setEnabled(false);
Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class)).search Objects.requireNonNull(MainViewerGUI.getComponent(SearchBoxPane.class))
.setText("Searching, please wait.."); .search.setText("Searching, please wait..");
t.start(); t.start();
} else { // this should really never be called. } else { // this should really never be called.
BytecodeViewer BytecodeViewer.showMessage("You currently have a search performing in the background, please wait for that to finish.");
.showMessage("You currently have a search performing in the background, please wait for that "
+ "to finish.");
} }
} else if (radius == SearchRadius.Current_Class) { } else if (radius == SearchRadius.Current_Class) {
final Viewer cv = Objects.requireNonNull(MainViewerGUI.getComponent(WorkPane.class)).getCurrentViewer(); final Viewer cv = Objects.requireNonNull(MainViewerGUI.getComponent(WorkPane.class)).getCurrentViewer();
@ -243,8 +237,4 @@ public class SearchBoxPane extends VisibleComponent {
treeRoot.removeAllChildren(); treeRoot.removeAllChildren();
tree.updateUI(); tree.updateUI();
} }
@Override
public void openFile(final FileContainer container, String name, byte[] contents) {
}
} }

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JInternalFrame; import javax.swing.JInternalFrame;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.util.FileChangeNotifier;
import the.bytecode.club.bytecodeviewer.util.FileContainer; import the.bytecode.club.bytecodeviewer.util.FileContainer;
/*************************************************************************** /***************************************************************************
@ -24,34 +23,18 @@ import the.bytecode.club.bytecodeviewer.util.FileContainer;
***************************************************************************/ ***************************************************************************/
/** /**
* Used to represent all the panes inside of Bytecode Viewer, this is temp code * Used to represent all the panes inside of Bytecode Viewer.
* that was included from porting in J-RET, this needs to be re-written.
* *
* @author Konloch * @author Konloch
* @author WaterWolf * @author WaterWolf
*/ */
public abstract class VisibleComponent extends JInternalFrame
public abstract class VisibleComponent extends JInternalFrame implements {
FileChangeNotifier {
private static final long serialVersionUID = -6453413772343643526L; private static final long serialVersionUID = -6453413772343643526L;
public VisibleComponent(final String title) { public VisibleComponent(final String title)
{
super(title, false, false, false, false); super(title, false, false, false, false);
this.setFrameIcon(null); this.setFrameIcon(null);
} }
@SuppressWarnings("unused")
private VisibleComponent() { // because we want to enforce the title
// argument
}
@Override
public void openClassFile(final FileContainer container, final String name, final ClassNode cn) {
}
@Override
public void openFile(final FileContainer container, final String name, byte[] contents) {
}
} }

View file

@ -20,7 +20,6 @@ import javax.swing.JTabbedPane;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.util.FileChangeNotifier;
import the.bytecode.club.bytecodeviewer.util.FileContainer; import the.bytecode.club.bytecodeviewer.util.FileContainer;
import static the.bytecode.club.bytecodeviewer.Constants.BLOCK_TAB_MENU; import static the.bytecode.club.bytecodeviewer.Constants.BLOCK_TAB_MENU;
@ -54,7 +53,6 @@ public class WorkPane extends VisibleComponent implements ActionListener {
private static final long serialVersionUID = 6542337997679487946L; private static final long serialVersionUID = 6542337997679487946L;
FileChangeNotifier fcn;
public JTabbedPane tabs; public JTabbedPane tabs;
JPanel buttonPanel; JPanel buttonPanel;
@ -62,12 +60,11 @@ public class WorkPane extends VisibleComponent implements ActionListener {
HashMap<String, Integer> workingOn = new HashMap<>(); HashMap<String, Integer> workingOn = new HashMap<>();
public WorkPane(final FileChangeNotifier fcn) { public WorkPane() {
super("WorkPanel"); super("WorkPanel");
setTitle("Work Space"); setTitle("Work Space");
this.tabs = new JTabbedPane(); this.tabs = new JTabbedPane();
this.fcn = fcn;
JPopupMenu pop_up = new JPopupMenu() { JPopupMenu pop_up = new JPopupMenu() {
@ -251,16 +248,6 @@ public class WorkPane extends VisibleComponent implements ActionListener {
} }
} }
@Override
public void openClassFile(final FileContainer container, final String name, final ClassNode cn) {
addWorkingFile(container, name, cn);
}
@Override
public void openFile(final FileContainer container, final String name, byte[] content) {
addFile(container, name, content);
}
public Viewer getCurrentViewer() { public Viewer getCurrentViewer() {
return (Viewer) tabs.getSelectedComponent(); return (Viewer) tabs.getSelectedComponent();
} }
@ -285,14 +272,14 @@ public class WorkPane extends VisibleComponent implements ActionListener {
if (tabComp != null) { if (tabComp != null) {
if (tabComp instanceof ClassViewer) { if (tabComp instanceof ClassViewer) {
src.setEnabled(false); src.setEnabled(false);
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
((ClassViewer) tabComp).startPaneUpdater(src); ((ClassViewer) tabComp).startPaneUpdater(src);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} else if (tabComp instanceof FileViewer) { } else if (tabComp instanceof FileViewer) {
src.setEnabled(false); src.setEnabled(false);
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
((FileViewer) tabComp).refresh(src); ((FileViewer) tabComp).refresh(src);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} }
} }
} }

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui.extras;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui.extras;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@ -59,11 +59,11 @@ public class ExportJar extends JFrame {
getContentPane().add(btnNewButton); getContentPane().add(btnNewButton);
btnNewButton.addActionListener(arg0 -> { btnNewButton.addActionListener(arg0 -> {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), jarPath, JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), jarPath,
mani.getText()); mani.getText());
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
}); });
t.start(); t.start();
dispose(); dispose();

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui.extras;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.JButton; import javax.swing.JButton;

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui.extras;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;

View file

@ -1,4 +1,4 @@
package com.jhe.hexed; package the.bytecode.club.bytecodeviewer.gui.hexviewer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;

View file

@ -1,4 +1,4 @@
package com.jhe.hexed; package the.bytecode.club.bytecodeviewer.gui.hexviewer;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;

View file

@ -1,4 +1,4 @@
package com.jhe.hexed; package the.bytecode.club.bytecodeviewer.gui.hexviewer;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui.plugins;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui.plugins;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.JButton; import javax.swing.JButton;

View file

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui.plugins;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.JButton; import javax.swing.JButton;

View file

@ -33,12 +33,12 @@ public abstract class JavaObfuscator extends Thread {
@Override @Override
public void run() { public void run() {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Configuration.runningObfuscation = true; Configuration.runningObfuscation = true;
obfuscate(); obfuscate();
BytecodeViewer.refactorer.run(); BytecodeViewer.refactorer.run();
Configuration.runningObfuscation = false; Configuration.runningObfuscation = false;
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} }
public int getStringLength() { public int getStringLength() {

View file

@ -14,7 +14,7 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.BytecodeHook; import the.bytecode.club.bytecodeviewer.api.BytecodeHook;
import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole; import the.bytecode.club.bytecodeviewer.api.PluginConsole;
import the.bytecode.club.bytecodeviewer.gui.GraphicalReflectionKit; import the.bytecode.club.bytecodeviewer.gui.plugins.GraphicalReflectionKit;
import static the.bytecode.club.bytecodeviewer.Constants.*; import static the.bytecode.club.bytecodeviewer.Constants.*;
@ -135,7 +135,7 @@ public class EZInjection extends Plugin {
@Override @Override
public void execute(ArrayList<ClassNode> classNodeList) { public void execute(ArrayList<ClassNode> classNodeList) {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
gui.setText(""); gui.setText("");
if (console) if (console)
@ -307,6 +307,6 @@ public class EZInjection extends Plugin {
} }
} }
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} }
} }

View file

@ -42,9 +42,9 @@ public abstract class BackgroundSearchThread extends Thread {
@Override @Override
public void run() { public void run() {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
doSearch(); doSearch();
finished = true; finished = true;
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} }
} }

View file

@ -1,33 +0,0 @@
package the.bytecode.club.bytecodeviewer.util;
import org.objectweb.asm.tree.ClassNode;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
/**
* Used to represent whenever a file has been opened
*
* @author Konloch
*/
public interface FileChangeNotifier {
void openClassFile(final FileContainer container, String name, ClassNode cn);
void openFile(final FileContainer container, String name, byte[] contents);
}

View file

@ -30,12 +30,11 @@ import java.io.Reader;
* a Java program. Any <tt>java.awt.Component</tt> can be dropped onto, but only * a Java program. Any <tt>java.awt.Component</tt> can be dropped onto, but only
* <tt>javax.swing.JComponent</tt>s will indicate the drop event with a changed * <tt>javax.swing.JComponent</tt>s will indicate the drop event with a changed
* border. * border.
* <p/> *
* To use this class, construct a new <tt>FileDrop</tt> by passing it the target * To use this class, construct a new <tt>FileDrop</tt> by passing it the target
* component and a <tt>Listener</tt> to receive notification when file(s) have * component and a <tt>Listener</tt> to receive notification when file(s) have
* been dropped. Here is an example: * been dropped. Here is an example:
* <p/> *
* <code><pre>
* JPanel myPanel = new JPanel(); * JPanel myPanel = new JPanel();
* new FileDrop( myPanel, new FileDrop.Listener() * new FileDrop( myPanel, new FileDrop.Listener()
* { public void filesDropped( java.io.File[] files ) * { public void filesDropped( java.io.File[] files )
@ -44,27 +43,21 @@ import java.io.Reader;
* ... * ...
* } // end filesDropped * } // end filesDropped
* }); // end FileDrop.Listener * }); // end FileDrop.Listener
* </pre></code> *
* <p/>
* You can specify the border that will appear when files are being dragged by * You can specify the border that will appear when files are being dragged by
* calling the constructor with a <tt>javax.swing.border.Border</tt>. Only * calling the constructor with a <tt>javax.swing.border.Border</tt>. Only
* <tt>JComponent</tt>s will show any indication with a border. * <tt>JComponent</tt>s will show any indication with a border.
* <p/> *
* You can turn on some debugging features by passing a <tt>PrintStream</tt> * You can turn on some debugging features by passing a <tt>PrintStream</tt>
* object (such as <tt>System.out</tt>) into the full constructor. A * object (such as <tt>System.out</tt>) into the full constructor. A
* <tt>null</tt> value will result in no extra debugging information being * <tt>null</tt> value will result in no extra debugging information being
* output. * output.
* <p/> *
* <p>
* <p>
* I'm releasing this code into the Public Domain. Enjoy. * I'm releasing this code into the Public Domain. Enjoy.
* </p> *
* <p>
* <em>Original author: Robert Harder, rharder@usa.net</em> * <em>Original author: Robert Harder, rharder@usa.net</em>
* </p> *
* <p>
* 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. * 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
* </p>
* *
* @author Robert Harder * @author Robert Harder
* @author rharder@users.sf.net * @author rharder@users.sf.net

View file

@ -131,7 +131,7 @@ public class OpenFile implements Runnable
} }
} else if (fn.endsWith(".apk")) { } else if (fn.endsWith(".apk")) {
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
File tempCopy = new File(tempDirectory + fs + MiscUtils.randomString(32) + ".apk"); File tempCopy = new File(tempDirectory + fs + MiscUtils.randomString(32) + ".apk");
@ -159,7 +159,7 @@ public class OpenFile implements Runnable
container.classes = JarUtils.loadClasses(output); container.classes = JarUtils.loadClasses(output);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
BytecodeViewer.files.add(container); BytecodeViewer.files.add(container);
} catch (final Exception e) { } catch (final Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
@ -167,7 +167,7 @@ public class OpenFile implements Runnable
return; return;
} else if (fn.endsWith(".dex")) { } else if (fn.endsWith(".dex")) {
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
File tempCopy = new File(tempDirectory + fs + MiscUtils.randomString(32) + File tempCopy = new File(tempDirectory + fs + MiscUtils.randomString(32) +
".dex"); ".dex");
@ -186,7 +186,7 @@ public class OpenFile implements Runnable
container.classes = JarUtils.loadClasses(output); container.classes = JarUtils.loadClasses(output);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
BytecodeViewer.files.add(container); BytecodeViewer.files.add(container);
} catch (final Exception e) { } catch (final Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
@ -208,7 +208,7 @@ public class OpenFile implements Runnable
} catch (final Exception e) { } catch (final Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} finally { } finally {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
if (update) if (update)
try { try {

View file

@ -6,7 +6,6 @@ import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.decompilers.Decompilers; import the.bytecode.club.bytecodeviewer.decompilers.Decompilers;
import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileFilter;
@ -91,7 +90,7 @@ public class ResourceDecompiling
if (options[k].equals(obj)) if (options[k].equals(obj))
result = k; result = k;
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
File tempZip = new File(tempDirectory + fs + "temp_" + MiscUtils.getRandomizedName() + ".jar"); File tempZip = new File(tempDirectory + fs + "temp_" + MiscUtils.getRandomizedName() + ".jar");
if (tempZip.exists()) if (tempZip.exists())
@ -104,7 +103,7 @@ public class ResourceDecompiling
try { try {
Decompilers.procyon.decompileToZip(tempZip.getAbsolutePath(), Decompilers.procyon.decompileToZip(tempZip.getAbsolutePath(),
MiscUtils.append(javaSucks, "-proycon.zip")); MiscUtils.append(javaSucks, "-proycon.zip"));
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -112,10 +111,10 @@ public class ResourceDecompiling
t12.start(); t12.start();
Thread t2 = new Thread(() -> { Thread t2 = new Thread(() -> {
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Decompilers.cfr.decompileToZip(tempZip.getAbsolutePath(), Decompilers.cfr.decompileToZip(tempZip.getAbsolutePath(),
MiscUtils.append(javaSucks, "-CFR.zip")); MiscUtils.append(javaSucks, "-CFR.zip"));
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -123,10 +122,10 @@ public class ResourceDecompiling
t2.start(); t2.start();
Thread t3 = new Thread(() -> { Thread t3 = new Thread(() -> {
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Decompilers.fernflower.decompileToZip(tempZip.getAbsolutePath(), Decompilers.fernflower.decompileToZip(tempZip.getAbsolutePath(),
MiscUtils.append(javaSucks, "-fernflower.zip")); MiscUtils.append(javaSucks, "-fernflower.zip"));
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -134,10 +133,10 @@ public class ResourceDecompiling
t3.start(); t3.start();
Thread t4 = new Thread(() -> { Thread t4 = new Thread(() -> {
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Decompilers.krakatau.decompileToZip(tempZip.getAbsolutePath(), Decompilers.krakatau.decompileToZip(tempZip.getAbsolutePath(),
MiscUtils.append(javaSucks, "-kraktau.zip")); MiscUtils.append(javaSucks, "-kraktau.zip"));
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -148,7 +147,7 @@ public class ResourceDecompiling
Thread t12 = new Thread(() -> { Thread t12 = new Thread(() -> {
try { try {
Decompilers.procyon.decompileToZip(tempZip.getAbsolutePath(), path); Decompilers.procyon.decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -159,7 +158,7 @@ public class ResourceDecompiling
Thread t12 = new Thread(() -> { Thread t12 = new Thread(() -> {
try { try {
Decompilers.cfr.decompileToZip(tempZip.getAbsolutePath(), path); Decompilers.cfr.decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -170,7 +169,7 @@ public class ResourceDecompiling
Thread t12 = new Thread(() -> { Thread t12 = new Thread(() -> {
try { try {
Decompilers.fernflower.decompileToZip(tempZip.getAbsolutePath(), path); Decompilers.fernflower.decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -182,7 +181,7 @@ public class ResourceDecompiling
Thread t12 = new Thread(() -> { Thread t12 = new Thread(() -> {
try { try {
Decompilers.krakatau.decompileToZip(tempZip.getAbsolutePath(), path); Decompilers.krakatau.decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); new ExceptionUI(e);
} }
@ -191,7 +190,7 @@ public class ResourceDecompiling
} }
if (result == 5) { if (result == 5) {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} }
} }
}); });
@ -232,7 +231,7 @@ public class ResourceDecompiling
if (returnVal == JFileChooser.APPROVE_OPTION) { if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile(); File file = fc.getSelectedFile();
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
final String path = MiscUtils.append(file, ".java"); // cheap hax cause final String path = MiscUtils.append(file, ".java"); // cheap hax cause
// string is final // string is final
@ -315,9 +314,9 @@ public class ResourceDecompiling
e.printStackTrace(); e.printStackTrace();
} }
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
new ExceptionUI(e); new ExceptionUI(e);
} }
}); });
@ -341,9 +340,9 @@ public class ResourceDecompiling
String contents = Decompilers.procyon.decompileClassNode(cn, String contents = Decompilers.procyon.decompileClassNode(cn,
cw.toByteArray()); cw.toByteArray());
DiskWriter.replaceFile(path, contents, false); DiskWriter.replaceFile(path, contents, false);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
new ExceptionUI( new ExceptionUI(
e); e);
} }
@ -367,9 +366,9 @@ public class ResourceDecompiling
} }
String contents = Decompilers.cfr.decompileClassNode(cn, cw.toByteArray()); String contents = Decompilers.cfr.decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(path, contents, false); DiskWriter.replaceFile(path, contents, false);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
new ExceptionUI( new ExceptionUI(
e); e);
} }
@ -395,9 +394,9 @@ public class ResourceDecompiling
String contents = Decompilers.fernflower.decompileClassNode(cn, String contents = Decompilers.fernflower.decompileClassNode(cn,
cw.toByteArray()); cw.toByteArray());
DiskWriter.replaceFile(path, contents, false); DiskWriter.replaceFile(path, contents, false);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
new ExceptionUI( new ExceptionUI(
e); e);
} }
@ -423,9 +422,9 @@ public class ResourceDecompiling
String contents = Decompilers.krakatau.decompileClassNode(cn, String contents = Decompilers.krakatau.decompileClassNode(cn,
cw.toByteArray()); cw.toByteArray());
DiskWriter.replaceFile(path, contents, false); DiskWriter.replaceFile(path, contents, false);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
new ExceptionUI( new ExceptionUI(
e); e);
} }
@ -433,7 +432,7 @@ public class ResourceDecompiling
t1.start(); t1.start();
} }
if (result == 5) { if (result == 5) {
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
} }
} }
}); });

View file

@ -1,7 +1,7 @@
package the.bytecode.club.bytecodeviewer.util; package the.bytecode.club.bytecodeviewer.util;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.gui.ExportJar; import the.bytecode.club.bytecodeviewer.gui.extras.ExportJar;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileFilter;
@ -128,11 +128,11 @@ public class ResourceExporting
final File file2 = file; final File file2 = file;
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
Thread t17 = new Thread(() -> { Thread t17 = new Thread(() -> {
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
file2.getAbsolutePath()); file2.getAbsolutePath());
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
}); });
t17.start(); t17.start();
} }
@ -195,14 +195,14 @@ public class ResourceExporting
} }
Thread t16 = new Thread(() -> { Thread t16 = new Thread(() -> {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
final String input = tempDirectory + fs + MiscUtils.getRandomizedName() + ".jar"; final String input = tempDirectory + fs + MiscUtils.getRandomizedName() + ".jar";
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), input); JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), input);
Thread t15 = new Thread(() -> { Thread t15 = new Thread(() -> {
Dex2Jar.saveAsDex(new File(input), file2); Dex2Jar.saveAsDex(new File(input), file2);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
}); });
t15.start(); t15.start();
}); });
@ -307,14 +307,14 @@ public class ResourceExporting
} }
Thread t14 = new Thread(() -> { Thread t14 = new Thread(() -> {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.updateBusyStatus(true);
final String input = tempDirectory + fs + MiscUtils.getRandomizedName() + ".jar"; final String input = tempDirectory + fs + MiscUtils.getRandomizedName() + ".jar";
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), input); JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), input);
Thread t13 = new Thread(() -> { Thread t13 = new Thread(() -> {
APKTool.buildAPK(new File(input), file2, finalContainer); APKTool.buildAPK(new File(input), file2, finalContainer);
BytecodeViewer.viewer.setIcon(false); BytecodeViewer.viewer.updateBusyStatus(false);
}); });
t13.start(); t13.start();
}); });

View file

@ -106,6 +106,7 @@ public class SecurityMan extends SecurityManager {
public void checkAccess(ThreadGroup g) { public void checkAccess(ThreadGroup g) {
} }
@SuppressWarnings("deprecation")
public void checkAwtEventQueueAccess() { public void checkAwtEventQueueAccess() {
} }
@ -136,6 +137,7 @@ public class SecurityMan extends SecurityManager {
public void checkLink(String lib) { public void checkLink(String lib) {
} }
@SuppressWarnings("deprecation")
public void checkMemberAccess(Class<?> clazz, int which) { public void checkMemberAccess(Class<?> clazz, int which) {
} }
@ -143,10 +145,11 @@ public class SecurityMan extends SecurityManager {
public void checkMulticast(InetAddress maddr) { public void checkMulticast(InetAddress maddr) {
} }
@Override @SuppressWarnings("deprecation")
public void checkMulticast(InetAddress maddr, byte ttl) { public void checkMulticast(InetAddress maddr, byte ttl) {
} }
@SuppressWarnings("deprecation")
public void checkPackageAccess(String pkg) { public void checkPackageAccess(String pkg) {
} }
@ -186,6 +189,7 @@ public class SecurityMan extends SecurityManager {
public void checkSetFactory() { public void checkSetFactory() {
} }
@SuppressWarnings("deprecation")
public void checkSystemClipboardAccess() { public void checkSystemClipboardAccess() {
} }