Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
added find usage for method or field insn nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
TerriblePanda committed Nov 15, 2019
1 parent b15f6e7 commit 9899188
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/me/grax/jbytemod/ui/lists/MyCodeList.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ public void actionPerformed(ActionEvent e) {
}
if (ain instanceof MethodInsnNode) {
JMenuItem edit = new JMenuItem(JByteMod.res.getResource("go_to_dec"));
JMenuItem find_usage = new JMenuItem(JByteMod.res.getResource("find_usage"));
edit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MethodInsnNode min = (MethodInsnNode) ain;
Expand All @@ -372,10 +373,21 @@ public void actionPerformed(ActionEvent e) {
}
}
});

find_usage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
MethodInsnNode min = (MethodInsnNode) ain;
jbm.getSearchList().searchForFMInsn(((MethodInsnNode) ain).owner, ((MethodInsnNode) ain).name, ((MethodInsnNode) ain).desc, true, false);
}
});

menu.add(edit);
menu.add(find_usage);
}
if (ain instanceof FieldInsnNode) {
JMenuItem edit = new JMenuItem(JByteMod.res.getResource("go_to_dec"));
JMenuItem find_usage = new JMenuItem(JByteMod.res.getResource("find_usage"));
edit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FieldInsnNode fin = (FieldInsnNode) ain;
Expand All @@ -387,7 +399,17 @@ public void actionPerformed(ActionEvent e) {
}
}
});

find_usage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FieldInsnNode fin = (FieldInsnNode) ain;
jbm.getSearchList().searchForFMInsn(((FieldInsnNode) ain).owner, ((FieldInsnNode) ain).name, ((FieldInsnNode) ain).desc, true, true);
}
});

menu.add(edit);
menu.add(find_usage);
}
JMenuItem duplicate = new JMenuItem(JByteMod.res.getResource("duplicate"));
duplicate.addActionListener(new ActionListener() {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/locale/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
<string name="remove_lines">Remove lines</string>
<string name="remove_dead_code">Remove unreachable code</string>
<string name="add_method">Add method</string>
<string name="find_usage">Find usages</string>

<string name="generate_frames">Generate frames</string>
<string name="reload">Reload</string>
<string name="close">Close</string>
Expand Down

0 comments on commit 9899188

Please sign in to comment.