Better Plugin Integration
Instead of plugins running instantly you are given the option to edit them using the Plugin Writer
This commit is contained in:
parent
42d914d7a6
commit
dca90245e5
2 changed files with 16 additions and 7 deletions
|
@ -8,7 +8,9 @@ import javax.swing.*;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import me.konloch.kontainer.io.DiskReader;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import the.bytecode.club.bootloader.Boot;
|
||||
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
|
||||
|
@ -19,6 +21,7 @@ import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI;
|
|||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
||||
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer;
|
||||
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
|
||||
import the.bytecode.club.bytecodeviewer.plugin.PluginWriter;
|
||||
import the.bytecode.club.bytecodeviewer.util.*;
|
||||
import the.bytecode.club.bytecodeviewer.resources.importing.ImportResource;
|
||||
|
||||
|
@ -548,12 +551,16 @@ public class BytecodeViewer
|
|||
Settings.removeRecentPlugin(file);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
PluginManager.runPlugin(file);
|
||||
} catch (Throwable e) {
|
||||
|
||||
try
|
||||
{
|
||||
PluginWriter writer = new PluginWriter(DiskReader.loadAsString(file.getAbsolutePath()), file.getName());
|
||||
writer.setSourceFile(file);
|
||||
writer.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
BytecodeViewer.handleException(e);
|
||||
}
|
||||
|
||||
addRecentPlugin(file);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,9 +74,9 @@ public class PluginWriter extends JFrame
|
|||
menuSave.setVisible(false);
|
||||
|
||||
menuBar.add(menu);
|
||||
menu.add(menuRun);
|
||||
menu.add(menuSaveAs);
|
||||
menu.add(menuSave);
|
||||
menu.add(menuRun);
|
||||
|
||||
setJMenuBar(menuBar);
|
||||
add(area.getScrollPane());
|
||||
|
@ -98,7 +98,7 @@ public class PluginWriter extends JFrame
|
|||
try
|
||||
{
|
||||
//write to temporary file location
|
||||
DiskWriter.replaceFile(tempFile.getAbsolutePath(), area.getText(), false);
|
||||
DiskWriter.replaceFile(tempFile.getAbsolutePath(), area.getText(), true);
|
||||
//run plugin from that location
|
||||
PluginManager.runPlugin(tempFile);
|
||||
}
|
||||
|
@ -170,7 +170,9 @@ public class PluginWriter extends JFrame
|
|||
{
|
||||
menuSaveAs.setVisible(false);
|
||||
menuSave.setVisible(true);
|
||||
menuSaveAs.updateUI();
|
||||
menuSave.updateUI();
|
||||
savePath = file;
|
||||
setPluginName(file.getAbsolutePath());
|
||||
setPluginName(file.getName());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue