diff options
| author | 2019-02-23 19:42:00 +0200 | |
|---|---|---|
| committer | 2019-02-23 19:42:00 +0200 | |
| commit | bb20ce047a2e20866b9532c441c7433b1973ba5b (patch) | |
| tree | ed9f5bd596e43a1fffeef0b174c5370c039a9b62 /src/main/java/cuchaz/enigma/gui/elements | |
| parent | Tweak inheritance and implementation tree generation (diff) | |
| download | enigma-fork-bb20ce047a2e20866b9532c441c7433b1973ba5b.tar.gz enigma-fork-bb20ce047a2e20866b9532c441c7433b1973ba5b.tar.xz enigma-fork-bb20ce047a2e20866b9532c441c7433b1973ba5b.zip | |
Fix #110 and remap indices with matched bridge method names
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/elements')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/elements/MenuBar.java | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java b/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java index 14ad53d..d7be1a9 100644 --- a/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java +++ b/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java | |||
| @@ -5,7 +5,6 @@ import cuchaz.enigma.config.Themes; | |||
| 5 | import cuchaz.enigma.gui.Gui; | 5 | import cuchaz.enigma.gui.Gui; |
| 6 | import cuchaz.enigma.gui.dialog.AboutDialog; | 6 | import cuchaz.enigma.gui.dialog.AboutDialog; |
| 7 | import cuchaz.enigma.gui.dialog.SearchDialog; | 7 | import cuchaz.enigma.gui.dialog.SearchDialog; |
| 8 | import cuchaz.enigma.throwables.MappingParseException; | ||
| 9 | import cuchaz.enigma.translation.mapping.serde.MappingFormat; | 8 | import cuchaz.enigma.translation.mapping.serde.MappingFormat; |
| 10 | 9 | ||
| 11 | import javax.swing.*; | 10 | import javax.swing.*; |
| @@ -68,15 +67,9 @@ public class MenuBar extends JMenuBar { | |||
| 68 | openMenu.add(item); | 67 | openMenu.add(item); |
| 69 | item.addActionListener(event -> { | 68 | item.addActionListener(event -> { |
| 70 | if (this.gui.enigmaMappingsFileChooser.showOpenDialog(this.gui.getFrame()) == JFileChooser.APPROVE_OPTION) { | 69 | if (this.gui.enigmaMappingsFileChooser.showOpenDialog(this.gui.getFrame()) == JFileChooser.APPROVE_OPTION) { |
| 71 | try { | 70 | File selectedFile = this.gui.enigmaMappingsFileChooser.getSelectedFile(); |
| 72 | File selectedFile = this.gui.enigmaMappingsFileChooser.getSelectedFile(); | 71 | MappingFormat format = selectedFile.isDirectory() ? MappingFormat.ENIGMA_DIRECTORY : MappingFormat.ENIGMA_FILE; |
| 73 | MappingFormat format = selectedFile.isDirectory() ? MappingFormat.ENIGMA_DIRECTORY : MappingFormat.ENIGMA_FILE; | 72 | this.gui.getController().openMappings(format, selectedFile.toPath()); |
| 74 | this.gui.getController().openMappings(format, selectedFile.toPath()); | ||
| 75 | } catch (IOException ex) { | ||
| 76 | throw new Error(ex); | ||
| 77 | } catch (MappingParseException ex) { | ||
| 78 | JOptionPane.showMessageDialog(this.gui.getFrame(), ex.getMessage()); | ||
| 79 | } | ||
| 80 | } | 73 | } |
| 81 | }); | 74 | }); |
| 82 | this.openEnigmaMappingsMenu = item; | 75 | this.openEnigmaMappingsMenu = item; |
| @@ -87,13 +80,7 @@ public class MenuBar extends JMenuBar { | |||
| 87 | this.gui.tinyMappingsFileChooser.setVisible(true); | 80 | this.gui.tinyMappingsFileChooser.setVisible(true); |
| 88 | File file = new File(this.gui.tinyMappingsFileChooser.getDirectory() + File.separator + this.gui.tinyMappingsFileChooser.getFile()); | 81 | File file = new File(this.gui.tinyMappingsFileChooser.getDirectory() + File.separator + this.gui.tinyMappingsFileChooser.getFile()); |
| 89 | if (file.exists()) { | 82 | if (file.exists()) { |
| 90 | try { | 83 | this.gui.getController().openMappings(MappingFormat.TINY_FILE, file.toPath()); |
| 91 | this.gui.getController().openMappings(MappingFormat.TINY_FILE, file.toPath()); | ||
| 92 | } catch (IOException ex) { | ||
| 93 | throw new Error(ex); | ||
| 94 | } catch (MappingParseException ex) { | ||
| 95 | JOptionPane.showMessageDialog(this.gui.getFrame(), ex.getMessage()); | ||
| 96 | } | ||
| 97 | } | 84 | } |
| 98 | }); | 85 | }); |
| 99 | this.openTinyMappingsMenu = item; | 86 | this.openTinyMappingsMenu = item; |