diff options
| author | 2020-10-11 20:10:48 +0200 | |
|---|---|---|
| committer | 2020-10-11 20:10:48 +0200 | |
| commit | c6b53f392b8f85b2197d04c95620864d209a3ae6 (patch) | |
| tree | 391e545dcacc0f918b3a519be649a3f2660f25c8 | |
| parent | Revert "Only conflict when both methods are not synthetic" (diff) | |
| download | enigma-c6b53f392b8f85b2197d04c95620864d209a3ae6.tar.gz enigma-c6b53f392b8f85b2197d04c95620864d209a3ae6.tar.xz enigma-c6b53f392b8f85b2197d04c95620864d209a3ae6.zip | |
Add popup menu to deobf panel to quickly rename a package/class
| -rw-r--r-- | build.gradle | 2 | ||||
| -rw-r--r-- | enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java | 20 | ||||
| -rw-r--r-- | enigma-swing/src/main/java/cuchaz/enigma/gui/elements/DeobfPanelPopupMenu.java | 34 | ||||
| -rw-r--r-- | enigma/src/main/resources/lang/en_us.json | 1 | ||||
| -rw-r--r-- | enigma/src/main/resources/lang/fr_fr.json | 1 |
5 files changed, 53 insertions, 5 deletions
diff --git a/build.gradle b/build.gradle index 64fa167c..81c96fb9 100644 --- a/build.gradle +++ b/build.gradle | |||
| @@ -24,7 +24,7 @@ subprojects { | |||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | group = 'cuchaz' | 26 | group = 'cuchaz' |
| 27 | version = '0.21.4' | 27 | version = '0.21.5' |
| 28 | 28 | ||
| 29 | def buildNumber = System.getenv("BUILD_NUMBER") | 29 | def buildNumber = System.getenv("BUILD_NUMBER") |
| 30 | version = version + "+" + (buildNumber ? "build.$buildNumber" : "local") | 30 | version = version + "+" + (buildNumber ? "build.$buildNumber" : "local") |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java index 323d304a..cbc9688e 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java | |||
| @@ -37,10 +37,7 @@ import cuchaz.enigma.gui.config.UiConfig; | |||
| 37 | import cuchaz.enigma.gui.dialog.CrashDialog; | 37 | import cuchaz.enigma.gui.dialog.CrashDialog; |
| 38 | import cuchaz.enigma.gui.dialog.JavadocDialog; | 38 | import cuchaz.enigma.gui.dialog.JavadocDialog; |
| 39 | import cuchaz.enigma.gui.dialog.SearchDialog; | 39 | import cuchaz.enigma.gui.dialog.SearchDialog; |
| 40 | import cuchaz.enigma.gui.elements.CollapsibleTabbedPane; | 40 | import cuchaz.enigma.gui.elements.*; |
| 41 | import cuchaz.enigma.gui.elements.EditorTabPopupMenu; | ||
| 42 | import cuchaz.enigma.gui.elements.MenuBar; | ||
| 43 | import cuchaz.enigma.gui.elements.ValidatableUi; | ||
| 44 | import cuchaz.enigma.gui.events.EditorActionListener; | 41 | import cuchaz.enigma.gui.events.EditorActionListener; |
| 45 | import cuchaz.enigma.gui.panels.*; | 42 | import cuchaz.enigma.gui.panels.*; |
| 46 | import cuchaz.enigma.gui.util.History; | 43 | import cuchaz.enigma.gui.util.History; |
| @@ -107,6 +104,7 @@ public class Gui implements LanguageChangeListener { | |||
| 107 | private JLabel statusLabel; | 104 | private JLabel statusLabel; |
| 108 | 105 | ||
| 109 | private final EditorTabPopupMenu editorTabPopupMenu; | 106 | private final EditorTabPopupMenu editorTabPopupMenu; |
| 107 | private final DeobfPanelPopupMenu deobfPanelPopupMenu; | ||
| 110 | private final JTabbedPane openFiles; | 108 | private final JTabbedPane openFiles; |
| 111 | private final HashBiMap<ClassEntry, EditorPanel> editors = HashBiMap.create(); | 109 | private final HashBiMap<ClassEntry, EditorPanel> editors = HashBiMap.create(); |
| 112 | 110 | ||
| @@ -292,6 +290,19 @@ public class Gui implements LanguageChangeListener { | |||
| 292 | } | 290 | } |
| 293 | }); | 291 | }); |
| 294 | 292 | ||
| 293 | deobfPanelPopupMenu = new DeobfPanelPopupMenu(this); | ||
| 294 | deobfPanel.deobfClasses.addMouseListener(new MouseAdapter() { | ||
| 295 | @Override | ||
| 296 | public void mousePressed(MouseEvent e) { | ||
| 297 | if (SwingUtilities.isRightMouseButton(e)) { | ||
| 298 | int i = deobfPanel.deobfClasses.getRowForPath(deobfPanel.deobfClasses.getSelectionPath()); | ||
| 299 | if (i != -1) { | ||
| 300 | deobfPanelPopupMenu.show(deobfPanel.deobfClasses, e.getX(), e.getY()); | ||
| 301 | } | ||
| 302 | } | ||
| 303 | } | ||
| 304 | }); | ||
| 305 | |||
| 295 | // layout controls | 306 | // layout controls |
| 296 | JPanel centerPanel = new JPanel(); | 307 | JPanel centerPanel = new JPanel(); |
| 297 | centerPanel.setLayout(new BorderLayout()); | 308 | centerPanel.setLayout(new BorderLayout()); |
| @@ -893,6 +904,7 @@ public class Gui implements LanguageChangeListener { | |||
| 893 | this.menuBar.retranslateUi(); | 904 | this.menuBar.retranslateUi(); |
| 894 | this.obfPanel.retranslateUi(); | 905 | this.obfPanel.retranslateUi(); |
| 895 | this.deobfPanel.retranslateUi(); | 906 | this.deobfPanel.retranslateUi(); |
| 907 | this.deobfPanelPopupMenu.retranslateUi(); | ||
| 896 | this.infoPanel.retranslateUi(); | 908 | this.infoPanel.retranslateUi(); |
| 897 | this.editors.values().forEach(EditorPanel::retranslateUi); | 909 | this.editors.values().forEach(EditorPanel::retranslateUi); |
| 898 | } | 910 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/DeobfPanelPopupMenu.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/DeobfPanelPopupMenu.java new file mode 100644 index 00000000..a4d749c2 --- /dev/null +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/elements/DeobfPanelPopupMenu.java | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | package cuchaz.enigma.gui.elements; | ||
| 2 | |||
| 3 | import cuchaz.enigma.gui.ClassSelector; | ||
| 4 | import cuchaz.enigma.gui.Gui; | ||
| 5 | import cuchaz.enigma.utils.I18n; | ||
| 6 | |||
| 7 | import javax.swing.*; | ||
| 8 | import java.awt.*; | ||
| 9 | |||
| 10 | public class DeobfPanelPopupMenu { | ||
| 11 | |||
| 12 | private final JPopupMenu ui; | ||
| 13 | private final JMenuItem rename; | ||
| 14 | |||
| 15 | public DeobfPanelPopupMenu(Gui gui) { | ||
| 16 | this.ui = new JPopupMenu(); | ||
| 17 | |||
| 18 | ClassSelector deobfClasses = gui.getDeobfPanel().deobfClasses; | ||
| 19 | |||
| 20 | this.rename = new JMenuItem(); | ||
| 21 | this.rename.addActionListener(a -> deobfClasses.getUI().startEditingAtPath(deobfClasses, deobfClasses.getSelectionPath())); | ||
| 22 | this.ui.add(this.rename); | ||
| 23 | |||
| 24 | this.retranslateUi(); | ||
| 25 | } | ||
| 26 | |||
| 27 | public void show(Component invoker, int x, int y) { | ||
| 28 | this.ui.show(invoker, x, y); | ||
| 29 | } | ||
| 30 | |||
| 31 | public void retranslateUi() { | ||
| 32 | this.rename.setText(I18n.translate("popup_menu.deobf_panel.rename")); | ||
| 33 | } | ||
| 34 | } | ||
diff --git a/enigma/src/main/resources/lang/en_us.json b/enigma/src/main/resources/lang/en_us.json index b08962d5..caf179e2 100644 --- a/enigma/src/main/resources/lang/en_us.json +++ b/enigma/src/main/resources/lang/en_us.json | |||
| @@ -78,6 +78,7 @@ | |||
| 78 | "popup_menu.editor_tab.close_others": "Close Others", | 78 | "popup_menu.editor_tab.close_others": "Close Others", |
| 79 | "popup_menu.editor_tab.close_left": "Close All to the Left", | 79 | "popup_menu.editor_tab.close_left": "Close All to the Left", |
| 80 | "popup_menu.editor_tab.close_right": "Close All to the Right", | 80 | "popup_menu.editor_tab.close_right": "Close All to the Right", |
| 81 | "popup_menu.deobf_panel.rename": "Rename", | ||
| 81 | 82 | ||
| 82 | "editor.decompiling": "Decompiling...", | 83 | "editor.decompiling": "Decompiling...", |
| 83 | "editor.decompile_error": "An error was encountered while decompiling.", | 84 | "editor.decompile_error": "An error was encountered while decompiling.", |
diff --git a/enigma/src/main/resources/lang/fr_fr.json b/enigma/src/main/resources/lang/fr_fr.json index aad8f29e..b40a904f 100644 --- a/enigma/src/main/resources/lang/fr_fr.json +++ b/enigma/src/main/resources/lang/fr_fr.json | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | "popup_menu.editor_tab.close_others": "Fermer les autres", | 73 | "popup_menu.editor_tab.close_others": "Fermer les autres", |
| 74 | "popup_menu.editor_tab.close_left": "Tout fermer sur la gauche", | 74 | "popup_menu.editor_tab.close_left": "Tout fermer sur la gauche", |
| 75 | "popup_menu.editor_tab.close_right": "Tout fermer sur la droite", | 75 | "popup_menu.editor_tab.close_right": "Tout fermer sur la droite", |
| 76 | "popup_menu.deobf_panel.rename": "Renommer", | ||
| 76 | 77 | ||
| 77 | "editor.decompiling": "Décompilation...", | 78 | "editor.decompiling": "Décompilation...", |
| 78 | "editor.decompile_error": "Une erreur est survenue lors de la décompilation.", | 79 | "editor.decompile_error": "Une erreur est survenue lors de la décompilation.", |