diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/GuiController.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/GuiController.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/GuiController.java b/src/main/java/cuchaz/enigma/gui/GuiController.java index 45c6131..15211e0 100644 --- a/src/main/java/cuchaz/enigma/gui/GuiController.java +++ b/src/main/java/cuchaz/enigma/gui/GuiController.java | |||
| @@ -32,6 +32,7 @@ import cuchaz.enigma.translation.representation.entry.MethodEntry; | |||
| 32 | import cuchaz.enigma.utils.ReadableToken; | 32 | import cuchaz.enigma.utils.ReadableToken; |
| 33 | 33 | ||
| 34 | import javax.annotation.Nullable; | 34 | import javax.annotation.Nullable; |
| 35 | import javax.swing.*; | ||
| 35 | import java.awt.event.ItemEvent; | 36 | import java.awt.event.ItemEvent; |
| 36 | import java.io.File; | 37 | import java.io.File; |
| 37 | import java.io.IOException; | 38 | import java.io.IOException; |
| @@ -80,16 +81,22 @@ public class GuiController { | |||
| 80 | this.gui.onCloseJar(); | 81 | this.gui.onCloseJar(); |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | public void openMappings(MappingFormat format, Path path) throws IOException, MappingParseException { | 84 | public void openMappings(MappingFormat format, Path path) { |
| 84 | EntryTree<EntryMapping> mappings = format.read(path); | 85 | ProgressDialog.runInThread(this.gui.getFrame(), progress -> { |
| 85 | deobfuscator.setMappings(mappings); | 86 | try { |
| 87 | EntryTree<EntryMapping> mappings = format.read(path, progress); | ||
| 88 | deobfuscator.setMappings(mappings, progress); | ||
| 86 | 89 | ||
| 87 | gui.setMappingsFile(path); | 90 | gui.setMappingsFile(path); |
| 88 | loadedMappingFormat = format; | 91 | loadedMappingFormat = format; |
| 89 | loadedMappingPath = path; | 92 | loadedMappingPath = path; |
| 90 | 93 | ||
| 91 | refreshClasses(); | 94 | refreshClasses(); |
| 92 | refreshCurrentClass(); | 95 | refreshCurrentClass(); |
| 96 | } catch (MappingParseException e) { | ||
| 97 | JOptionPane.showMessageDialog(this.gui.getFrame(), e.getMessage()); | ||
| 98 | } | ||
| 99 | }); | ||
| 93 | } | 100 | } |
| 94 | 101 | ||
| 95 | public void saveMappings(Path path) { | 102 | public void saveMappings(Path path) { |