Error Prompt Cleanup
This commit is contained in:
parent
2a5977d980
commit
deb23d3dd3
12 changed files with 42 additions and 48 deletions
|
@ -523,6 +523,28 @@ public class BytecodeViewer
|
||||||
viewer.clearBusyStatus();
|
viewer.clearBusyStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if there are no loaded resource classes
|
||||||
|
*/
|
||||||
|
public static boolean promptIfNoLoadedClasses()
|
||||||
|
{
|
||||||
|
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||||
|
{
|
||||||
|
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the exception by creating a new window for bug reporting
|
||||||
|
*/
|
||||||
|
public static void handleException(Throwable t)
|
||||||
|
{
|
||||||
|
new ExceptionUI(t);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the title on all of the opened tabs
|
* Refreshes the title on all of the opened tabs
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,18 +47,16 @@ public class GlobalHotKeys
|
||||||
t.start();
|
t.start();
|
||||||
} else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
|
} else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
|
||||||
Configuration.lastHotKeyExecuted = System.currentTimeMillis();
|
Configuration.lastHotKeyExecuted = System.currentTimeMillis();
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
new RunOptions().setVisible(true);
|
new RunOptions().setVisible(true);
|
||||||
} else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
|
} else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
|
||||||
Configuration.lastHotKeyExecuted = System.currentTimeMillis();
|
Configuration.lastHotKeyExecuted = System.currentTimeMillis();
|
||||||
|
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Thread resourceExport = new Thread(() ->
|
Thread resourceExport = new Thread(() ->
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,11 +37,8 @@ public abstract class Plugin extends Thread
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
execute(BytecodeViewer.getLoadedClasses());
|
execute(BytecodeViewer.getLoadedClasses());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -791,10 +791,8 @@ public class MainViewerGUI extends JFrame
|
||||||
|
|
||||||
public void runResources()
|
public void runResources()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
new RunOptions().setVisible(true);
|
new RunOptions().setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,8 @@ public class MaliciousCodeScannerOptions extends JFrame
|
||||||
|
|
||||||
public static void open()
|
public static void open()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
new MaliciousCodeScannerOptions().setVisible(true);
|
new MaliciousCodeScannerOptions().setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,9 @@ public class ReplaceStringsOptions extends JFrame
|
||||||
{
|
{
|
||||||
public static void open()
|
public static void open()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
new ReplaceStringsOptions().setVisible(true);
|
new ReplaceStringsOptions().setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,17 +46,18 @@ public class CodeSequenceDiagram extends Plugin
|
||||||
{
|
{
|
||||||
public static void open()
|
public static void open()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
PluginManager.runPlugin(new CodeSequenceDiagram());
|
PluginManager.runPlugin(new CodeSequenceDiagram());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(ArrayList<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
|
return;
|
||||||
|
|
||||||
if (BytecodeViewer.viewer.workPane.getCurrentViewer() == null || !(BytecodeViewer.viewer.workPane.getCurrentViewer() instanceof ClassViewer))
|
if (BytecodeViewer.viewer.workPane.getCurrentViewer() == null || !(BytecodeViewer.viewer.workPane.getCurrentViewer() instanceof ClassViewer))
|
||||||
{
|
{
|
||||||
BytecodeViewer.showMessage("First open a class file.");
|
BytecodeViewer.showMessage("First open a class file.");
|
||||||
|
|
|
@ -28,11 +28,8 @@ public class ResourceDecompiling
|
||||||
{
|
{
|
||||||
public static void decompileSaveAll()
|
public static void decompileSaveAll()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Thread decompileThread = new Thread(() ->
|
Thread decompileThread = new Thread(() ->
|
||||||
{
|
{
|
||||||
|
@ -182,11 +179,8 @@ public class ResourceDecompiling
|
||||||
|
|
||||||
public static void decompileSaveOpenedOnly()
|
public static void decompileSaveOpenedOnly()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (BytecodeViewer.viewer.workPane.getCurrentViewer() == null || !(BytecodeViewer.viewer.workPane.getCurrentViewer() instanceof ClassViewer))
|
if (BytecodeViewer.viewer.workPane.getCurrentViewer() == null || !(BytecodeViewer.viewer.workPane.getCurrentViewer() instanceof ClassViewer))
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,11 +24,8 @@ public class APKExport implements Exporter
|
||||||
@Override
|
@Override
|
||||||
public void promptForExport()
|
public void promptForExport()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
List<FileContainer> containers = BytecodeViewer.getFiles();
|
List<FileContainer> containers = BytecodeViewer.getFiles();
|
||||||
List<FileContainer> validContainers = new ArrayList<>();
|
List<FileContainer> validContainers = new ArrayList<>();
|
||||||
|
|
|
@ -25,11 +25,8 @@ public class DexExport implements Exporter
|
||||||
@Override
|
@Override
|
||||||
public void promptForExport()
|
public void promptForExport()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Thread exportThread = new Thread(() ->
|
Thread exportThread = new Thread(() ->
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,11 +19,8 @@ public class RunnableJarExporter implements Exporter
|
||||||
@Override
|
@Override
|
||||||
public void promptForExport()
|
public void promptForExport()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Thread exportThread = new Thread(() ->
|
Thread exportThread = new Thread(() ->
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,11 +19,8 @@ public class ZipExport implements Exporter
|
||||||
@Override
|
@Override
|
||||||
public void promptForExport()
|
public void promptForExport()
|
||||||
{
|
{
|
||||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||||
{
|
|
||||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Thread exportThread = new Thread(() ->
|
Thread exportThread = new Thread(() ->
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue