diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/Gui.java | 5 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/GuiController.java | 4 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java | 12 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/Gui.java b/src/main/java/cuchaz/enigma/gui/Gui.java index 8ec58f9..53500aa 100644 --- a/src/main/java/cuchaz/enigma/gui/Gui.java +++ b/src/main/java/cuchaz/enigma/gui/Gui.java | |||
| @@ -537,6 +537,7 @@ public class Gui { | |||
| 537 | this.popupMenu.showInheritanceMenu.setEnabled(isClassEntry || isMethodEntry || isConstructorEntry); | 537 | this.popupMenu.showInheritanceMenu.setEnabled(isClassEntry || isMethodEntry || isConstructorEntry); |
| 538 | this.popupMenu.showImplementationsMenu.setEnabled(isClassEntry || isMethodEntry); | 538 | this.popupMenu.showImplementationsMenu.setEnabled(isClassEntry || isMethodEntry); |
| 539 | this.popupMenu.showCallsMenu.setEnabled(isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry); | 539 | this.popupMenu.showCallsMenu.setEnabled(isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry); |
| 540 | this.popupMenu.showCallsSpecificMenu.setEnabled(isMethodEntry); | ||
| 540 | this.popupMenu.openEntryMenu.setEnabled(isInJar && (isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry)); | 541 | this.popupMenu.openEntryMenu.setEnabled(isInJar && (isClassEntry || isFieldEntry || isMethodEntry || isConstructorEntry)); |
| 541 | this.popupMenu.openPreviousMenu.setEnabled(this.controller.hasPreviousLocation()); | 542 | this.popupMenu.openPreviousMenu.setEnabled(this.controller.hasPreviousLocation()); |
| 542 | this.popupMenu.toggleMappingMenu.setEnabled(isRenameable); | 543 | this.popupMenu.toggleMappingMenu.setEnabled(isRenameable); |
| @@ -694,7 +695,7 @@ public class Gui { | |||
| 694 | redraw(); | 695 | redraw(); |
| 695 | } | 696 | } |
| 696 | 697 | ||
| 697 | public void showCalls() { | 698 | public void showCalls(boolean recurse) { |
| 698 | if (reference == null) { | 699 | if (reference == null) { |
| 699 | return; | 700 | return; |
| 700 | } | 701 | } |
| @@ -706,7 +707,7 @@ public class Gui { | |||
| 706 | FieldReferenceTreeNode node = this.controller.getFieldReferences((FieldEntry) reference.entry); | 707 | FieldReferenceTreeNode node = this.controller.getFieldReferences((FieldEntry) reference.entry); |
| 707 | callsTree.setModel(new DefaultTreeModel(node)); | 708 | callsTree.setModel(new DefaultTreeModel(node)); |
| 708 | } else if (reference.entry instanceof MethodEntry) { | 709 | } else if (reference.entry instanceof MethodEntry) { |
| 709 | MethodReferenceTreeNode node = this.controller.getMethodReferences((MethodEntry) reference.entry); | 710 | MethodReferenceTreeNode node = this.controller.getMethodReferences((MethodEntry) reference.entry, recurse); |
| 710 | callsTree.setModel(new DefaultTreeModel(node)); | 711 | callsTree.setModel(new DefaultTreeModel(node)); |
| 711 | } | 712 | } |
| 712 | 713 | ||
diff --git a/src/main/java/cuchaz/enigma/gui/GuiController.java b/src/main/java/cuchaz/enigma/gui/GuiController.java index acb0ebb..69aefe5 100644 --- a/src/main/java/cuchaz/enigma/gui/GuiController.java +++ b/src/main/java/cuchaz/enigma/gui/GuiController.java | |||
| @@ -209,10 +209,10 @@ public class GuiController { | |||
| 209 | return rootNode; | 209 | return rootNode; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | public MethodReferenceTreeNode getMethodReferences(MethodEntry deobfMethodEntry) { | 212 | public MethodReferenceTreeNode getMethodReferences(MethodEntry deobfMethodEntry, boolean recursive) { |
| 213 | MethodEntry obfMethodEntry = this.deobfuscator.obfuscateEntry(deobfMethodEntry); | 213 | MethodEntry obfMethodEntry = this.deobfuscator.obfuscateEntry(deobfMethodEntry); |
| 214 | MethodReferenceTreeNode rootNode = new MethodReferenceTreeNode(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfMethodEntry); | 214 | MethodReferenceTreeNode rootNode = new MethodReferenceTreeNode(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfMethodEntry); |
| 215 | rootNode.load(this.deobfuscator.getJarIndex(), true); | 215 | rootNode.load(this.deobfuscator.getJarIndex(), true, recursive); |
| 216 | return rootNode; | 216 | return rootNode; |
| 217 | } | 217 | } |
| 218 | 218 | ||
diff --git a/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java b/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java index 2f6d96c..32f9172 100644 --- a/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java +++ b/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java | |||
| @@ -3,6 +3,7 @@ package cuchaz.enigma.gui.elements; | |||
| 3 | import cuchaz.enigma.gui.Gui; | 3 | import cuchaz.enigma.gui.Gui; |
| 4 | 4 | ||
| 5 | import javax.swing.*; | 5 | import javax.swing.*; |
| 6 | import java.awt.event.InputEvent; | ||
| 6 | import java.awt.event.KeyEvent; | 7 | import java.awt.event.KeyEvent; |
| 7 | 8 | ||
| 8 | public class PopupMenuBar extends JPopupMenu { | 9 | public class PopupMenuBar extends JPopupMenu { |
| @@ -11,6 +12,7 @@ public class PopupMenuBar extends JPopupMenu { | |||
| 11 | public final JMenuItem showInheritanceMenu; | 12 | public final JMenuItem showInheritanceMenu; |
| 12 | public final JMenuItem showImplementationsMenu; | 13 | public final JMenuItem showImplementationsMenu; |
| 13 | public final JMenuItem showCallsMenu; | 14 | public final JMenuItem showCallsMenu; |
| 15 | public final JMenuItem showCallsSpecificMenu; | ||
| 14 | public final JMenuItem openEntryMenu; | 16 | public final JMenuItem openEntryMenu; |
| 15 | public final JMenuItem openPreviousMenu; | 17 | public final JMenuItem openPreviousMenu; |
| 16 | public final JMenuItem toggleMappingMenu; | 18 | public final JMenuItem toggleMappingMenu; |
| @@ -42,13 +44,21 @@ public class PopupMenuBar extends JPopupMenu { | |||
| 42 | } | 44 | } |
| 43 | { | 45 | { |
| 44 | JMenuItem menu = new JMenuItem("Show Calls"); | 46 | JMenuItem menu = new JMenuItem("Show Calls"); |
| 45 | menu.addActionListener(event -> gui.showCalls()); | 47 | menu.addActionListener(event -> gui.showCalls(true)); |
| 46 | menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, 0)); | 48 | menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, 0)); |
| 47 | menu.setEnabled(false); | 49 | menu.setEnabled(false); |
| 48 | this.add(menu); | 50 | this.add(menu); |
| 49 | this.showCallsMenu = menu; | 51 | this.showCallsMenu = menu; |
| 50 | } | 52 | } |
| 51 | { | 53 | { |
| 54 | JMenuItem menu = new JMenuItem("Show Calls (Specific)"); | ||
| 55 | menu.addActionListener(event -> gui.showCalls(false)); | ||
| 56 | menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.SHIFT_DOWN_MASK)); | ||
| 57 | menu.setEnabled(false); | ||
| 58 | this.add(menu); | ||
| 59 | this.showCallsSpecificMenu = menu; | ||
| 60 | } | ||
| 61 | { | ||
| 52 | JMenuItem menu = new JMenuItem("Go to Declaration"); | 62 | JMenuItem menu = new JMenuItem("Go to Declaration"); |
| 53 | menu.addActionListener(event -> gui.navigateTo(gui.reference.entry)); | 63 | menu.addActionListener(event -> gui.navigateTo(gui.reference.entry)); |
| 54 | menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, 0)); | 64 | menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, 0)); |