Beta 1.3.1 (Lightweight and Speed updates)

10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes
the search feature inside of source/bytecode files, I'll implement a
search function soon.
10/29/2014 - Added a new decompiler option to append brackets to labels.
10/31/2014 - Fixed an issue with the decompiler still running when the
source code pane isn't toggled.

This update removes JSyntaxPane and replaces it with RSyntaxAreaPane,
this change improves speed greatly for bigger class files, there is
literally zero delay for syntax highlighting now.
This commit is contained in:
Kalen Kinloch 2014-10-31 17:55:17 -07:00
parent 7baee5d008
commit 21754375b0
9 changed files with 64 additions and 54 deletions

Binary file not shown.

View File

@ -107,4 +107,8 @@ Changelog:
10/29/2014 - When saving as jars or zips, it'll automatically append the file extension if it's not added.
10/29/2014 - All the built in plugins no longer set the cursor to busy.
10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
10/29/2014 - Sped up start up time
10/29/2014 - Sped up start up time
--- Beta 1.3.1 ---:
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
10/29/2014 - Added a new decompiler option to append brackets to labels.
10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.

View File

@ -1 +1 @@
Beta 1.3
Beta 1.3.1

View File

@ -137,6 +137,10 @@ import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
* 10/29/2014 - All the built in plugins no longer set the cursor to busy.
* 10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
* 10/29/2014 - Sped up start up time.
* ----Beta 1.3.1-----:
* 10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
* 10/29/2014 - Added a new decompiler option to append brackets to labels.
* 10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
*
* @author Konloch
*
@ -155,7 +159,7 @@ public class BytecodeViewer {
public static String tempDirectory = "bcv_temp";
public static String fs = System.getProperty("file.separator");
public static String nl = System.getProperty("line.separator");
public static String version = "Beta 1.3";
public static String version = "Beta 1.3.1";
public static void main(String[] args) {
cleanup();
@ -176,7 +180,7 @@ public class BytecodeViewer {
String version = reader.readLine();
reader.close();
if(!BytecodeViewer.version.equals(version))
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version);
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version+nl+nl+"https://github.com/Konloch/bytecode-viewer");
} catch(Exception e) {
e.printStackTrace();
}

View File

@ -83,6 +83,7 @@ public class InstructionPrinter {
public ArrayList<String> createPrint() {
ArrayList<String> info = new ArrayList<String>();
ListIterator<?> it = mNode.instructions.iterator();
boolean firstLabel = false;
while (it.hasNext()) {
AbstractInsnNode ain = (AbstractInsnNode) it.next();
String line = "";
@ -103,7 +104,16 @@ public class InstructionPrinter {
} else if (ain instanceof LineNumberNode) {
line = printLineNumberNode((LineNumberNode) ain, it);
} else if (ain instanceof LabelNode) {
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
info.add("}");
line = printLabelnode((LabelNode) ain);
if(BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()) {
if(!firstLabel)
firstLabel = true;
line += " {";
}
} else if (ain instanceof TypeInsnNode) {
line = printTypeInsnNode((TypeInsnNode) ain);
} else if (ain instanceof FrameNode) {
@ -125,6 +135,8 @@ public class InstructionPrinter {
info.add(line);
}
}
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
info.add("}");
return info;
}

View File

@ -8,7 +8,7 @@ import java.awt.Color;
public class AboutWindow extends JFrame {
public AboutWindow() {
setSize(new Dimension(403, 484));
setSize(new Dimension(403, 374));
setType(Type.UTILITY);
setTitle("Bytecode Viewer - About");
getContentPane().setLayout(new CardLayout(0, 0));
@ -17,7 +17,7 @@ public class AboutWindow extends JFrame {
txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
txtrBytecodeViewerIs.setWrapStyleWord(true);
getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
txtrBytecodeViewerIs.setText("Bytecode Viewer is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n JSyntaxPane by Ayman Al\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nLimitations:\r\n Syntax highlighting on files that are\r\nbigger than 10K lines can take a while to\r\nload, you may want to disable the syntax\r\nhighlighting for large files.\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttp://the.bytecode.club");
txtrBytecodeViewerIs.setText("Bytecode Viewer is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n JSyntaxPane by Ayman Al\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttp://the.bytecode.club");
txtrBytecodeViewerIs.setEnabled(false);
this.setResizable(false);
this.setLocationRelativeTo(null);

View File

@ -10,7 +10,6 @@ import java.util.ArrayList;
import static javax.swing.ScrollPaneConstants.*;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
@ -27,6 +26,9 @@ import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import javax.swing.text.html.ParagraphView;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
@ -101,8 +103,6 @@ public class ClassViewer extends JPanel {
sourcePane = BytecodeViewer.viewer.sourcePane.isSelected();
bytecodePane = BytecodeViewer.viewer.bytecodePane.isSelected();
hexPane = BytecodeViewer.viewer.hexPane.isSelected();
boolean bytecodeSyntax = BytecodeViewer.viewer.bycSyntax.isSelected();
boolean sourcecodeSyntax = BytecodeViewer.viewer.srcSyntax.isSelected();
this.name = name;
this.cn = cn;
this.setName(name);
@ -127,8 +127,6 @@ public class ClassViewer extends JPanel {
resetDivider();
BytecodeViewer.viewer.setIcon(true);
//
startPaneUpdater();
this.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
@ -166,38 +164,39 @@ public class ClassViewer extends JPanel {
public void doShit() {
final String b = ClassNodeDecompiler.decompile(cn);
if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
s = ff_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
s = proc_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
s = cfr_dc.decompileClassNode(cn);
if(BytecodeViewer.viewer.sourcePane.isSelected()) {
if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
s = ff_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
s = proc_dc.decompileClassNode(cn);
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
s = cfr_dc.decompileClassNode(cn);
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JEditorPane
bytecode = new JEditorPane(),
decomp = new JEditorPane();
JScrollPane
bytecodeScroll = new JScrollPane(bytecode),
decompScroll = new JScrollPane(decomp);
if(bytecodePane && BytecodeViewer.viewer.bycSyntax.isSelected())
bytecode.setContentType("text/java");
if(sourcePane && BytecodeViewer.viewer.srcSyntax.isSelected())
decomp.setContentType("text/java");
if(bytecodePane)
bytecode.setText(b);
if(sourcePane)
decomp.setText(s);
RSyntaxTextArea bytecodeArea = new RSyntaxTextArea();
bytecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
bytecodeArea.setCodeFoldingEnabled(true);
bytecodeArea.setAntiAliasingEnabled(true);
RTextScrollPane bytecodeSPane = new RTextScrollPane(bytecodeArea);
bytecodeArea.setText(b);
bytePanel.add(bytecodeScroll);
decompPanel.add(decompScroll);
RSyntaxTextArea sourcecodeArea = new RSyntaxTextArea();
sourcecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
sourcecodeArea.setCodeFoldingEnabled(true);
sourcecodeArea.setAntiAliasingEnabled(true);
RTextScrollPane sourcecodeSPane = new RTextScrollPane(sourcecodeArea);
sourcecodeArea.setText(s);
if(BytecodeViewer.viewer.bytecodePane.isSelected())
bytePanel.add(bytecodeSPane);
if(BytecodeViewer.viewer.sourcePane.isSelected())
decompPanel.add(sourcecodeSPane);
bytecodeArea.setCaretPosition(0);
sourcecodeArea.setCaretPosition(0);
bytecode.setCaretPosition(0);
decomp.setCaretPosition(0);
BytecodeViewer.viewer.setIcon(false);
}
});

View File

@ -99,7 +99,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
private final JMenuItem mntmShowMainMethods = new JMenuItem("Show Main Methods");
private final JMenuItem mntmNewMenuItem_3 = new JMenuItem("Save As Jar..");
private JMenuBar menuBar = new JMenuBar();
public JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
public JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("Allow Only ASCII Characters In Strings");
private final JMenuItem mntmReplaceStrings = new JMenuItem("Replace Strings");
private final JMenuItem mntmNewMenuItem_4 = new JMenuItem("");
private final JMenu mnNewMenu_2 = new JMenu("Java Decompiler");
@ -167,6 +167,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_9 = new JCheckBoxMenuItem("Force Explicit Imports");
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_10 = new JCheckBoxMenuItem("Flatten Switch Blocks");
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_11 = new JCheckBoxMenuItem("Exclude Nested Types");
public final JCheckBoxMenuItem chckbxmntmAppendBrackets = new JCheckBoxMenuItem("Append Brackets To Labels");
public void setC(boolean busy) {
@ -308,6 +309,9 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
forceturningifs.setSelected(true);
forloopaggcapture.setSelected(true);
//procyon
/*none*/
//other
chckbxmntmAppendBrackets.setSelected(true);
setJMenuBar(menuBar);
@ -600,6 +604,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
mnBytecodeDecompilerSettings.add(debugHelpers);
mnBytecodeDecompilerSettings.add(chckbxmntmAppendBrackets);
mnBytecodeDecompilerSettings.add(chckbxmntmNewCheckItem);
menuBar.add(mnNewMenu_1);

View File

@ -3,12 +3,10 @@ package the.bytecode.club.bytecodeviewer.gui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.lang.reflect.Field;
import java.util.HashMap;
import javax.swing.JButton;
@ -17,8 +15,6 @@ import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import jsyntaxpane.DefaultSyntaxKit;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
@ -51,17 +47,6 @@ public class WorkPane extends VisibleComponent implements ActionListener {
super("WorkPanel");
setTitle("Work Space");
DefaultSyntaxKit.initKit();
Font defFont = null;
try {
final Field defFontField = DefaultSyntaxKit.class.getDeclaredField("DEFAULT_FONT");
defFontField.setAccessible(true);
defFont = (Font) defFontField.get(null);
} catch (final Exception e) {
e.printStackTrace();
}
SyntaxFontHeight = defFont.getSize();
this.tabs = new JTabbedPane();
this.fcn = fcn;