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