diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/Gui.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/Gui.java | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/Gui.java b/src/main/java/cuchaz/enigma/gui/Gui.java index 1ea3e44..5eeb07d 100644 --- a/src/main/java/cuchaz/enigma/gui/Gui.java +++ b/src/main/java/cuchaz/enigma/gui/Gui.java | |||
| @@ -36,6 +36,7 @@ import cuchaz.enigma.gui.util.History; | |||
| 36 | import cuchaz.enigma.throwables.IllegalNameException; | 36 | import cuchaz.enigma.throwables.IllegalNameException; |
| 37 | import cuchaz.enigma.translation.mapping.*; | 37 | import cuchaz.enigma.translation.mapping.*; |
| 38 | import cuchaz.enigma.translation.representation.entry.*; | 38 | import cuchaz.enigma.translation.representation.entry.*; |
| 39 | import cuchaz.enigma.utils.I18n; | ||
| 39 | import cuchaz.enigma.utils.Utils; | 40 | import cuchaz.enigma.utils.Utils; |
| 40 | import de.sciss.syntaxpane.DefaultSyntaxKit; | 41 | import de.sciss.syntaxpane.DefaultSyntaxKit; |
| 41 | 42 | ||
| @@ -120,12 +121,12 @@ public class Gui { | |||
| 120 | this.controller = new GuiController(this, profile); | 121 | this.controller = new GuiController(this, profile); |
| 121 | 122 | ||
| 122 | // init file choosers | 123 | // init file choosers |
| 123 | this.jarFileChooser = new FileDialog(getFrame(), "Open Jar", FileDialog.LOAD); | 124 | this.jarFileChooser = new FileDialog(getFrame(), I18n.translate("menu.file.jar.open"), FileDialog.LOAD); |
| 124 | 125 | ||
| 125 | this.tinyMappingsFileChooser = new FileDialog(getFrame(), "Open tiny Mappings", FileDialog.LOAD); | 126 | this.tinyMappingsFileChooser = new FileDialog(getFrame(), "Open tiny Mappings", FileDialog.LOAD); |
| 126 | this.enigmaMappingsFileChooser = new FileChooserAny(); | 127 | this.enigmaMappingsFileChooser = new FileChooserAny(); |
| 127 | this.exportSourceFileChooser = new FileChooserFolder(); | 128 | this.exportSourceFileChooser = new FileChooserFolder(); |
| 128 | this.exportJarFileChooser = new FileDialog(getFrame(), "Export jar", FileDialog.SAVE); | 129 | this.exportJarFileChooser = new FileDialog(getFrame(), I18n.translate("menu.file.export.jar"), FileDialog.SAVE); |
| 129 | 130 | ||
| 130 | this.obfPanel = new PanelObf(this); | 131 | this.obfPanel = new PanelObf(this); |
| 131 | this.deobfPanel = new PanelDeobf(this); | 132 | this.deobfPanel = new PanelDeobf(this); |
| @@ -275,9 +276,9 @@ public class Gui { | |||
| 275 | centerPanel.add(sourceScroller, BorderLayout.CENTER); | 276 | centerPanel.add(sourceScroller, BorderLayout.CENTER); |
| 276 | tabs = new JTabbedPane(); | 277 | tabs = new JTabbedPane(); |
| 277 | tabs.setPreferredSize(new Dimension(250, 0)); | 278 | tabs.setPreferredSize(new Dimension(250, 0)); |
| 278 | tabs.addTab("Inheritance", inheritancePanel); | 279 | tabs.addTab(I18n.translate("info_panel.tree.inheritance"), inheritancePanel); |
| 279 | tabs.addTab("Implementations", implementationsPanel); | 280 | tabs.addTab(I18n.translate("info_panel.tree.implementations"), implementationsPanel); |
| 280 | tabs.addTab("Call Graph", callPanel); | 281 | tabs.addTab(I18n.translate("info_panel.tree.calls"), callPanel); |
| 281 | JSplitPane splitRight = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, centerPanel, tabs); | 282 | JSplitPane splitRight = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, centerPanel, tabs); |
| 282 | splitRight.setResizeWeight(1); // let the left side take all the slack | 283 | splitRight.setResizeWeight(1); // let the left side take all the slack |
| 283 | splitRight.resetToPreferredSizes(); | 284 | splitRight.resetToPreferredSizes(); |
| @@ -458,33 +459,33 @@ public class Gui { | |||
| 458 | } | 459 | } |
| 459 | 460 | ||
| 460 | private void showLocalVariableEntry(LocalVariableEntry entry) { | 461 | private void showLocalVariableEntry(LocalVariableEntry entry) { |
| 461 | addNameValue(infoPanel, "Variable", entry.getName()); | 462 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.variable"), entry.getName()); |
| 462 | addNameValue(infoPanel, "Class", entry.getContainingClass().getFullName()); | 463 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.class"), entry.getContainingClass().getFullName()); |
| 463 | addNameValue(infoPanel, "Method", entry.getParent().getName()); | 464 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.method"), entry.getParent().getName()); |
| 464 | addNameValue(infoPanel, "Index", Integer.toString(entry.getIndex())); | 465 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.index"), Integer.toString(entry.getIndex())); |
| 465 | } | 466 | } |
| 466 | 467 | ||
| 467 | private void showClassEntry(ClassEntry entry) { | 468 | private void showClassEntry(ClassEntry entry) { |
| 468 | addNameValue(infoPanel, "Class", entry.getFullName()); | 469 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.class"), entry.getFullName()); |
| 469 | addModifierComboBox(infoPanel, "Modifier", entry); | 470 | addModifierComboBox(infoPanel, I18n.translate("info_panel.identifier.modifier"), entry); |
| 470 | } | 471 | } |
| 471 | 472 | ||
| 472 | private void showFieldEntry(FieldEntry entry) { | 473 | private void showFieldEntry(FieldEntry entry) { |
| 473 | addNameValue(infoPanel, "Field", entry.getName()); | 474 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.field"), entry.getName()); |
| 474 | addNameValue(infoPanel, "Class", entry.getParent().getFullName()); | 475 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.class"), entry.getParent().getFullName()); |
| 475 | addNameValue(infoPanel, "TypeDescriptor", entry.getDesc().toString()); | 476 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.type_descriptor"), entry.getDesc().toString()); |
| 476 | addModifierComboBox(infoPanel, "Modifier", entry); | 477 | addModifierComboBox(infoPanel, I18n.translate("info_panel.identifier.modifier"), entry); |
| 477 | } | 478 | } |
| 478 | 479 | ||
| 479 | private void showMethodEntry(MethodEntry entry) { | 480 | private void showMethodEntry(MethodEntry entry) { |
| 480 | if (entry.isConstructor()) { | 481 | if (entry.isConstructor()) { |
| 481 | addNameValue(infoPanel, "Constructor", entry.getParent().getFullName()); | 482 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.constructor"), entry.getParent().getFullName()); |
| 482 | } else { | 483 | } else { |
| 483 | addNameValue(infoPanel, "Method", entry.getName()); | 484 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.method"), entry.getName()); |
| 484 | addNameValue(infoPanel, "Class", entry.getParent().getFullName()); | 485 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.class"), entry.getParent().getFullName()); |
| 485 | } | 486 | } |
| 486 | addNameValue(infoPanel, "MethodDescriptor", entry.getDesc().toString()); | 487 | addNameValue(infoPanel, I18n.translate("info_panel.identifier.method_descriptor"), entry.getDesc().toString()); |
| 487 | addModifierComboBox(infoPanel, "Modifier", entry); | 488 | addModifierComboBox(infoPanel, I18n.translate("info_panel.identifier.modifier"), entry); |
| 488 | } | 489 | } |
| 489 | 490 | ||
| 490 | private void addNameValue(JPanel container, String name, String value) { | 491 | private void addNameValue(JPanel container, String name, String value) { |
| @@ -573,9 +574,9 @@ public class Gui { | |||
| 573 | this.popupMenu.toggleMappingMenu.setEnabled(isRenamable); | 574 | this.popupMenu.toggleMappingMenu.setEnabled(isRenamable); |
| 574 | 575 | ||
| 575 | if (isToken && !Objects.equals(referenceEntry, mapper.deobfuscate(referenceEntry))) { | 576 | if (isToken && !Objects.equals(referenceEntry, mapper.deobfuscate(referenceEntry))) { |
| 576 | this.popupMenu.toggleMappingMenu.setText("Reset to obfuscated"); | 577 | this.popupMenu.toggleMappingMenu.setText(I18n.translate("popup_menu.reset_obfuscated")); |
| 577 | } else { | 578 | } else { |
| 578 | this.popupMenu.toggleMappingMenu.setText("Mark as deobfuscated"); | 579 | this.popupMenu.toggleMappingMenu.setText(I18n.translate("popup_menu.mark_deobfuscated")); |
| 579 | } | 580 | } |
| 580 | } | 581 | } |
| 581 | 582 | ||
| @@ -794,7 +795,7 @@ public class Gui { | |||
| 794 | } | 795 | } |
| 795 | 796 | ||
| 796 | public void showDiscardDiag(Function<Integer, Void> callback, String... options) { | 797 | public void showDiscardDiag(Function<Integer, Void> callback, String... options) { |
| 797 | int response = JOptionPane.showOptionDialog(this.frame, "Your mappings have not been saved yet. Do you want to save?", "Save your changes?", JOptionPane.YES_NO_CANCEL_OPTION, | 798 | int response = JOptionPane.showOptionDialog(this.frame, I18n.translate("prompt.close.summary"), I18n.translate("prompt.close.title"), JOptionPane.YES_NO_CANCEL_OPTION, |
| 798 | JOptionPane.QUESTION_MESSAGE, null, options, options[2]); | 799 | JOptionPane.QUESTION_MESSAGE, null, options, options[2]); |
| 799 | callback.apply(response); | 800 | callback.apply(response); |
| 800 | } | 801 | } |
| @@ -820,7 +821,7 @@ public class Gui { | |||
| 820 | } | 821 | } |
| 821 | 822 | ||
| 822 | return null; | 823 | return null; |
| 823 | }, "Save and exit", "Discard changes", "Cancel"); | 824 | }, I18n.translate("prompt.close.save"), I18n.translate("prompt.close.discard"), I18n.translate("prompt.close.cancel")); |
| 824 | } | 825 | } |
| 825 | } | 826 | } |
| 826 | 827 | ||