Auto Compile Code Cleanup
This commit is contained in:
parent
5c0eadf643
commit
2aefec533b
9 changed files with 37 additions and 30 deletions
|
@ -398,6 +398,21 @@ public class BytecodeViewer
|
|||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called any time refresh is called to automatically compile all of the compilable panes that're opened.
|
||||
*/
|
||||
public static boolean autoCompileSuccessful()
|
||||
{
|
||||
if(!BytecodeViewer.viewer.autoCompileOnRefresh.isSelected())
|
||||
return true;
|
||||
|
||||
try {
|
||||
return compile(true);
|
||||
} catch (NullPointerException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile all of the compilable panes that're opened.
|
||||
*
|
||||
|
@ -682,7 +697,7 @@ public class BytecodeViewer
|
|||
|
||||
Thread resourceExport = new Thread(() ->
|
||||
{
|
||||
if (viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
JFileChooser fc = new FileChooser(Configuration.getLastDirectory(),
|
||||
|
|
|
@ -23,11 +23,8 @@ public class WorkPaneRefresh implements Runnable
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (BytecodeViewer.viewer.autoCompileOnRefresh.isSelected())
|
||||
try {
|
||||
if (!BytecodeViewer.compile(false))
|
||||
return;
|
||||
} catch (NullPointerException ignored) { }
|
||||
if (!BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
JButton src = null;
|
||||
if(event != null && event.getSource() instanceof JButton)
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package the.bytecode.club.bytecodeviewer.plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||
|
@ -41,7 +39,7 @@ public final class PluginManager {
|
|||
|
||||
private static final Map<String, PluginLaunchStrategy> launchStrategies = new HashMap<>();
|
||||
private static final PluginFileFilter filter = new PluginFileFilter();
|
||||
private static Plugin pluginInstance;
|
||||
private static List<Plugin> pluginInstances = new ArrayList<>();
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -67,14 +65,16 @@ public final class PluginManager {
|
|||
*
|
||||
* @param newPluginInstance the new plugin instance
|
||||
*/
|
||||
public static void runPlugin(Plugin newPluginInstance) {
|
||||
if (pluginInstance == null || pluginInstance.isFinished()) {
|
||||
pluginInstance = newPluginInstance;
|
||||
pluginInstance.start(); // start the thread
|
||||
} else if (!pluginInstance.isFinished()) {
|
||||
BytecodeViewer.showMessage("There is currently another plugin running right now, please wait for that to "
|
||||
+ "finish executing.");
|
||||
}
|
||||
public static void runPlugin(Plugin newPluginInstance)
|
||||
{
|
||||
//clean the plugin list from dead threads
|
||||
pluginInstances.removeIf(Plugin::isFinished);
|
||||
|
||||
//add to the list of running instances
|
||||
pluginInstances.add(newPluginInstance);
|
||||
|
||||
//start the plugin thread
|
||||
newPluginInstance.start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -126,7 +126,7 @@ public class PluginWriter extends JFrame
|
|||
{
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
if (BytecodeViewer.viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
if(savePath == null)
|
||||
|
|
|
@ -8,13 +8,11 @@ import the.bytecode.club.bytecodeviewer.Configuration;
|
|||
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
|
||||
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.FileChooser;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
|
||||
import the.bytecode.club.bytecodeviewer.util.DialogueUtils;
|
||||
import the.bytecode.club.bytecodeviewer.util.JarUtils;
|
||||
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -37,7 +35,7 @@ public class ResourceDecompiling
|
|||
|
||||
Thread decompileThread = new Thread(() ->
|
||||
{
|
||||
if (BytecodeViewer.viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
JFileChooser fc = new FileChooser(Configuration.getLastDirectory(),
|
||||
|
@ -189,7 +187,7 @@ public class ResourceDecompiling
|
|||
}
|
||||
|
||||
Thread decompileThread = new Thread(() -> {
|
||||
if (BytecodeViewer.viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
final String s = BytecodeViewer.viewer.workPane.getCurrentViewer().cn.name;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class APKExport implements Exporter
|
|||
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
if (BytecodeViewer.viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
JFileChooser fc = new FileChooser(Configuration.getLastDirectory(),
|
||||
|
|
|
@ -3,7 +3,6 @@ package the.bytecode.club.bytecodeviewer.resources.exporting.impl;
|
|||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.FileChooser;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
|
||||
import the.bytecode.club.bytecodeviewer.resources.exporting.Exporter;
|
||||
import the.bytecode.club.bytecodeviewer.util.Dex2Jar;
|
||||
import the.bytecode.club.bytecodeviewer.util.DialogueUtils;
|
||||
|
@ -34,7 +33,7 @@ public class DexExport implements Exporter
|
|||
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
if (BytecodeViewer.viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
JFileChooser fc = new FileChooser(Configuration.getLastDirectory(),
|
||||
|
|
|
@ -4,7 +4,6 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
|||
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.ExportJar;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.FileChooser;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
|
||||
import the.bytecode.club.bytecodeviewer.resources.exporting.Exporter;
|
||||
import the.bytecode.club.bytecodeviewer.util.DialogueUtils;
|
||||
|
||||
|
@ -28,7 +27,7 @@ public class RunnableJarExporter implements Exporter
|
|||
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
if (BytecodeViewer.viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
JFileChooser fc = new FileChooser(Configuration.getLastDirectory(),
|
||||
|
|
|
@ -3,7 +3,6 @@ package the.bytecode.club.bytecodeviewer.resources.exporting.impl;
|
|||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.FileChooser;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
|
||||
import the.bytecode.club.bytecodeviewer.resources.exporting.Exporter;
|
||||
import the.bytecode.club.bytecodeviewer.util.DialogueUtils;
|
||||
import the.bytecode.club.bytecodeviewer.util.JarUtils;
|
||||
|
@ -28,7 +27,7 @@ public class ZipExport implements Exporter
|
|||
|
||||
Thread exportThread = new Thread(() ->
|
||||
{
|
||||
if (BytecodeViewer.viewer.compileOnSave.isSelected() && !BytecodeViewer.compile(false))
|
||||
if (BytecodeViewer.autoCompileSuccessful())
|
||||
return;
|
||||
|
||||
JFileChooser fc = new FileChooser(Configuration.getLastDirectory(),
|
||||
|
|
Loading…
Reference in a new issue