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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
|
|
@ -47,18 +47,16 @@ public class GlobalHotKeys
|
|||
t.start();
|
||||
} else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
|
||||
Configuration.lastHotKeyExecuted = System.currentTimeMillis();
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
new RunOptions().setVisible(true);
|
||||
} else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
|
||||
Configuration.lastHotKeyExecuted = System.currentTimeMillis();
|
||||
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
Thread resourceExport = new Thread(() ->
|
||||
{
|
||||
|
|
|
@ -37,11 +37,8 @@ public abstract class Plugin extends Thread
|
|||
|
||||
try
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
execute(BytecodeViewer.getLoadedClasses());
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -791,10 +791,8 @@ public class MainViewerGUI extends JFrame
|
|||
|
||||
public void runResources()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
new RunOptions().setVisible(true);
|
||||
}
|
||||
|
|
|
@ -41,11 +41,8 @@ public class MaliciousCodeScannerOptions extends JFrame
|
|||
|
||||
public static void open()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
new MaliciousCodeScannerOptions().setVisible(true);
|
||||
}
|
||||
|
|
|
@ -40,10 +40,9 @@ public class ReplaceStringsOptions extends JFrame
|
|||
{
|
||||
public static void open()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty()) {
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
new ReplaceStringsOptions().setVisible(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,17 +46,18 @@ public class CodeSequenceDiagram extends Plugin
|
|||
{
|
||||
public static void open()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
PluginManager.runPlugin(new CodeSequenceDiagram());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ArrayList<ClassNode> classNodeList)
|
||||
{
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
|
||||
if (BytecodeViewer.viewer.workPane.getCurrentViewer() == null || !(BytecodeViewer.viewer.workPane.getCurrentViewer() instanceof ClassViewer))
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class file.");
|
||||
|
|
|
@ -28,11 +28,8 @@ public class ResourceDecompiling
|
|||
{
|
||||
public static void decompileSaveAll()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
Thread decompileThread = new Thread(() ->
|
||||
{
|
||||
|
@ -182,11 +179,8 @@ public class ResourceDecompiling
|
|||
|
||||
public static void decompileSaveOpenedOnly()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
if (BytecodeViewer.viewer.workPane.getCurrentViewer() == null || !(BytecodeViewer.viewer.workPane.getCurrentViewer() instanceof ClassViewer))
|
||||
{
|
||||
|
|
|
@ -24,11 +24,8 @@ public class APKExport implements Exporter
|
|||
@Override
|
||||
public void promptForExport()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
List<FileContainer> containers = BytecodeViewer.getFiles();
|
||||
List<FileContainer> validContainers = new ArrayList<>();
|
||||
|
|
|
@ -25,11 +25,8 @@ public class DexExport implements Exporter
|
|||
@Override
|
||||
public void promptForExport()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
|
|
|
@ -19,11 +19,8 @@ public class RunnableJarExporter implements Exporter
|
|||
@Override
|
||||
public void promptForExport()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
|
|
|
@ -19,11 +19,8 @@ public class ZipExport implements Exporter
|
|||
@Override
|
||||
public void promptForExport()
|
||||
{
|
||||
if (BytecodeViewer.getLoadedClasses().isEmpty())
|
||||
{
|
||||
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
|
||||
if (BytecodeViewer.promptIfNoLoadedClasses())
|
||||
return;
|
||||
}
|
||||
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue