summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/gui/GuiController.java
diff options
context:
space:
mode:
authorGravatar Thog2016-08-24 00:40:12 +0200
committerGravatar Thog2016-08-24 00:40:12 +0200
commit58c0189e572792ec488c29a4a67e7ae0ce9e6334 (patch)
tree94fbc455e6cf16638801c2fed46a191e34751aca /src/main/java/cuchaz/enigma/gui/GuiController.java
parentIgnore all files that start with "." and not end with ".mapping" (fix #8) (diff)
downloadenigma-fork-58c0189e572792ec488c29a4a67e7ae0ce9e6334.tar.gz
enigma-fork-58c0189e572792ec488c29a4a67e7ae0ce9e6334.tar.xz
enigma-fork-58c0189e572792ec488c29a4a67e7ae0ce9e6334.zip
Rewrite rename update for packages render, now package will never be closed during renaming (Fix #6)
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/GuiController.java')
-rw-r--r--src/main/java/cuchaz/enigma/gui/GuiController.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/GuiController.java b/src/main/java/cuchaz/enigma/gui/GuiController.java
index cc645d8..e466f63 100644
--- a/src/main/java/cuchaz/enigma/gui/GuiController.java
+++ b/src/main/java/cuchaz/enigma/gui/GuiController.java
@@ -12,24 +12,21 @@ package cuchaz.enigma.gui;
12 12
13import com.google.common.collect.Lists; 13import com.google.common.collect.Lists;
14import com.google.common.collect.Queues; 14import com.google.common.collect.Queues;
15
16import com.strobel.decompiler.languages.java.ast.CompilationUnit; 15import com.strobel.decompiler.languages.java.ast.CompilationUnit;
16import cuchaz.enigma.Deobfuscator;
17import cuchaz.enigma.analysis.*;
18import cuchaz.enigma.gui.dialog.ProgressDialog;
19import cuchaz.enigma.mapping.*;
20import cuchaz.enigma.throwables.MappingParseException;
21import cuchaz.enigma.utils.ReadableToken;
17 22
18import java.io.File; 23import java.io.File;
19import java.io.FileWriter;
20import java.io.IOException; 24import java.io.IOException;
21import java.util.Collection; 25import java.util.Collection;
22import java.util.Deque; 26import java.util.Deque;
23import java.util.List; 27import java.util.List;
24import java.util.jar.JarFile; 28import java.util.jar.JarFile;
25 29
26import cuchaz.enigma.Deobfuscator;
27import cuchaz.enigma.analysis.*;
28import cuchaz.enigma.gui.dialog.ProgressDialog;
29import cuchaz.enigma.mapping.*;
30import cuchaz.enigma.throwables.MappingParseException;
31import cuchaz.enigma.utils.ReadableToken;
32
33public class GuiController { 30public class GuiController {
34 31
35 private Deobfuscator deobfuscator; 32 private Deobfuscator deobfuscator;
@@ -192,18 +189,26 @@ public class GuiController {
192 } 189 }
193 190
194 public void rename(EntryReference<Entry, Entry> deobfReference, String newName) { 191 public void rename(EntryReference<Entry, Entry> deobfReference, String newName) {
192 rename(deobfReference, newName, true);
193 }
194
195 public void rename(EntryReference<Entry, Entry> deobfReference, String newName, boolean refreshClassTree)
196 {
195 EntryReference<Entry, Entry> obfReference = this.deobfuscator.obfuscateReference(deobfReference); 197 EntryReference<Entry, Entry> obfReference = this.deobfuscator.obfuscateReference(deobfReference);
196 this.deobfuscator.rename(obfReference.getNameableEntry(), newName); 198 this.deobfuscator.rename(obfReference.getNameableEntry(), newName);
197 this.isDirty = true; 199 this.isDirty = true;
198 refreshClasses(); 200
201 if (refreshClassTree)
202 this.gui.moveClassTree(deobfReference, newName);
199 refreshCurrentClass(obfReference); 203 refreshCurrentClass(obfReference);
204
200 } 205 }
201 206
202 public void removeMapping(EntryReference<Entry, Entry> deobfReference) { 207 public void removeMapping(EntryReference<Entry, Entry> deobfReference) {
203 EntryReference<Entry, Entry> obfReference = this.deobfuscator.obfuscateReference(deobfReference); 208 EntryReference<Entry, Entry> obfReference = this.deobfuscator.obfuscateReference(deobfReference);
204 this.deobfuscator.removeMapping(obfReference.getNameableEntry()); 209 this.deobfuscator.removeMapping(obfReference.getNameableEntry());
205 this.isDirty = true; 210 this.isDirty = true;
206 refreshClasses(); 211 this.gui.moveClassTree(deobfReference, obfReference.entry.getName(), false, true);
207 refreshCurrentClass(obfReference); 212 refreshCurrentClass(obfReference);
208 } 213 }
209 214
@@ -211,7 +216,6 @@ public class GuiController {
211 EntryReference<Entry, Entry> obfReference = this.deobfuscator.obfuscateReference(deobfReference); 216 EntryReference<Entry, Entry> obfReference = this.deobfuscator.obfuscateReference(deobfReference);
212 this.deobfuscator.markAsDeobfuscated(obfReference.getNameableEntry()); 217 this.deobfuscator.markAsDeobfuscated(obfReference.getNameableEntry());
213 this.isDirty = true; 218 this.isDirty = true;
214 refreshClasses();
215 refreshCurrentClass(obfReference); 219 refreshCurrentClass(obfReference);
216 } 220 }
217 221