fix: Remove field/method shown in context-menu for non-primary resource classes
@@ -346,6 +346,7 @@ public class ContextBuilder {
// Add options for fields we have knowledge of
if(hasClass(controller, owner)) {
if (declaration) {
+ if (isPrimaryClass(owner)) {
MenuItem remove = new ActionMenuItem(LangUtil.translate("misc.remove"), () -> {
YesNoWindow.prompt(LangUtil.translate("misc.confirm.message"), () -> {
byte[] updated = ClassUtil.removeField(reader, node.name, node.desc);
@@ -354,6 +355,7 @@ public class ContextBuilder {
}, null).show(classView);
});
menu.getItems().add(remove);
+ }
} else {
MenuItem jump = new ActionMenuItem(LangUtil.translate("ui.edit.method.goto"), () -> {
ClassViewport view = controller.windows().getMainWindow().openClass(resource, owner);
@@ -427,6 +429,7 @@ public class ContextBuilder {
// Add options for methods we have knowledge of
if(hasClass(controller, owner)) {
if (declaration) {
+ if (isPrimaryClass(owner)) {
MenuItem remove = new ActionMenuItem(LangUtil.translate("misc.remove"), () -> {
YesNoWindow.prompt(LangUtil.translate("misc.confirm.message"), () -> {
byte[] updated = ClassUtil.removeMethod(reader, node.name, node.desc);
@@ -435,6 +438,7 @@ public class ContextBuilder {
}, null).show(classView);
});
menu.getItems().add(remove);
+ }
} else {
MenuItem jump = new ActionMenuItem(LangUtil.translate("ui.edit.method.goto"), () -> {
ClassViewport view = controller.windows().getMainWindow().openClass(resource, owner);
