Indentation in decompilers to 4 spaces, fixed some threading issues

This commit is contained in:
SuspiciousActivity committed 2021-03-12 00:29:09 +01:00
1 parent 71437eac81
commit 71c224f83f
5 files changed
+36 -26

No files matched your search

+1 -2
View File
@@ -40,11 +40,10 @@ public class TypeOpenBox extends JFrame {
DefaultListModel<String> model = new DefaultListModel<>();
JList<String> list = new JList(model);
list.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
String val = list.getSelectedValue();
if (val != null && !val.equals(Main.currentNodeName)) {
SingleThreadedExecutor.execute(() -> Main.selectFile(val));
}
}
@@ -63,6 +63,7 @@ public class FernflowerDecompiler implements IBytecodeProvider, IResultSaver, ID
for (Entry<String, Boolean> entry : options.entrySet()) {
map.put(entry.getKey(), entry.getValue() ? "1" : "0");
}
map.put("ind", " ");
Fernflower f = new Fernflower(this, this, map, new IFernflowerLogger() {
@Override
public void writeMessage(String message, Throwable t) {
+1 -1
View File
@@ -43,7 +43,7 @@ public class JDDecompiler implements Loader, Printer, IDecompiler {
return cw.toByteArray();
}
protected static final String TAB = " ";
protected static final String TAB = " ";
protected static final String NEWLINE = "\n";
protected int indentationCount = 0;
+1 -2
View File
@@ -48,11 +48,10 @@ public class TypeOpenBox extends JFrame {
DefaultListModel<String> model = new DefaultListModel<>();
JList<String> list = new JList(model);
list.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
String val = list.getSelectedValue();
if (val != null && !val.equals(Main.currentNodeName)) {
SingleThreadedExecutor.execute(() -> Main.selectFile(val));
}
}
+32 -21
View File
@@ -303,7 +303,7 @@ public class Main extends JFrame {
try {
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile), classNodes,
otherFiles);
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
synchronized (treeLock) {
tree.setModel(model);
@@ -320,7 +320,7 @@ public class Main extends JFrame {
}
}
});
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -458,7 +458,7 @@ public class Main extends JFrame {
try {
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile), classNodes,
otherFiles);
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
synchronized (treeLock) {
tree.setModel(model);
@@ -467,7 +467,7 @@ public class Main extends JFrame {
}
}
});
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -545,7 +545,7 @@ public class Main extends JFrame {
try {
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile),
classNodes, otherFiles);
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
synchronized (treeLock) {
tree.setModel(model);
@@ -562,7 +562,7 @@ public class Main extends JFrame {
}
}
});
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -667,12 +667,14 @@ public class Main extends JFrame {
decompileCurrentNode();
try {
EventQueue.invokeAndWait(() -> {
txtByteEditView.setCaretPosition(0);
try {
txtByteEditView.setSyntaxEditingStyle(decompiler.getSyntaxStyle());
} catch (Throwable t) {
synchronized (treeLock) {
txtByteEditView.setCaretPosition(0);
try {
txtByteEditView.setSyntaxEditingStyle(decompiler.getSyntaxStyle());
} catch (Throwable t) {
}
txtByteEditView.setEditable(decompiler.isEditable());
}
txtByteEditView.setEditable(decompiler.isEditable());
});
} catch (Exception e1) {
e1.printStackTrace();
@@ -796,9 +798,14 @@ public class Main extends JFrame {
}
}
}
txtByteEditView.setText(dis);
if (dis.length() > prev)
txtByteEditView.setCaretPosition(prev);
String fdis = dis;
EventQueue.invokeAndWait(() -> {
synchronized (treeLock) {
txtByteEditView.setText(fdis);
if (fdis.length() > prev)
txtByteEditView.setCaretPosition(prev);
}
});
} catch (Exception e2) {
e2.printStackTrace();
}
@@ -857,14 +864,18 @@ public class Main extends JFrame {
public void run() {
synchronized (treeLock) {
save(file, classNodes.values());
EventQueue.invokeLater(new Runnable() {
public void run() {
synchronized (treeLock) {
isChangingFile = false;
Main.this.setTitle("ByteEdit");
try {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
synchronized (treeLock) {
isChangingFile = false;
Main.this.setTitle("ByteEdit");
}
}
}
});
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
}).start();