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
4 files changed
+23 -13

No files matched your search

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