GP-5052 - Moved some context menu actions into sub-menus

This commit is contained in:
dragonmacher 2024-10-28 18:10:06 -04:00
parent 6d5a5da013
commit b62b8f680d
6 changed files with 51 additions and 55 deletions

View file

@ -53,7 +53,7 @@
<LI>Right-mouse-click</LI> <LI>Right-mouse-click</LI>
<LI>Select Disassembly</LI> <LI>Select Disassemble <IMG SRC="help/shared/arrow.gif" /> Disassemble</LI>
</OL> </OL>
<P>The disassembly progress is displayed in the progress status area (bottom right) of the <P>The disassembly progress is displayed in the progress status area (bottom right) of the
@ -124,7 +124,7 @@
<LI>Right-mouse-click</LI> <LI>Right-mouse-click</LI>
<LI>Select Disassemble (Static).</LI> <LI>Select Disassemble <IMG SRC="help/shared/arrow.gif" /> Disassemble (Static).</LI>
</OL> </OL>
<P>The disassembly progress is displayed in the progress status area (bottom right) of the <P>The disassembly progress is displayed in the progress status area (bottom right) of the
@ -152,7 +152,7 @@
<OL> <OL>
<LI>Place the cursor in the Code Browser on an undefined byte.</LI> <LI>Place the cursor in the Code Browser on an undefined byte.</LI>
<LI>Right-mouse-click, and select Disassemble (Restricted).</LI> <LI>Right-mouse-click, and select Disassemble <IMG SRC="help/shared/arrow.gif" /> Disassemble (Restricted).</LI>
</OL> </OL>
<P>The disassembly progress is displayed in the progress status area (bottom right) of the <P>The disassembly progress is displayed in the progress status area (bottom right) of the
@ -231,9 +231,7 @@
<P>To changes the default processor options:</P> <P>To changes the default processor options:</P>
<OL> <OL>
<LI>Place the cursor in the Code Browser.</LI> <LI>Select Tools <IMG SRC="help/shared/arrow.gif" /> Processor Options... </LI>
<LI>Right-mouse-click, and select the "Processor Options" menu item.</LI>
<LI>Enter the values and press the "Ok" button.<BR> <LI>Enter the values and press the "Ok" button.<BR>
</LI> </LI>

View file

@ -42,6 +42,7 @@ import ghidra.program.util.*;
) )
//@formatter:on //@formatter:on
public class ClearPlugin extends Plugin { public class ClearPlugin extends Plugin {
private static final String CLEAR_MENU = "Clear";
private static final String CLEAR_WITH_OPTIONS_NAME = "Clear With Options"; private static final String CLEAR_WITH_OPTIONS_NAME = "Clear With Options";
private static final String CLEAR_CODE_BYTES_NAME = "Clear Code Bytes"; private static final String CLEAR_CODE_BYTES_NAME = "Clear Code Bytes";
private static final String CLEAR_FLOW_AND_REPAIR = "Clear Flow and Repair"; private static final String CLEAR_FLOW_AND_REPAIR = "Clear Flow and Repair";
@ -181,7 +182,7 @@ public class ClearPlugin extends Plugin {
new ActionBuilder(CLEAR_CODE_BYTES_NAME, getName()) new ActionBuilder(CLEAR_CODE_BYTES_NAME, getName())
.menuPath(ToolConstants.MENU_EDIT, CLEAR_CODE_BYTES_NAME) .menuPath(ToolConstants.MENU_EDIT, CLEAR_CODE_BYTES_NAME)
.menuGroup(CLEAR_CODE_BYTES_NAME, "1") .menuGroup(CLEAR_CODE_BYTES_NAME, "1")
.popupMenuPath(CLEAR_CODE_BYTES_NAME) .popupMenuPath(CLEAR_MENU, CLEAR_CODE_BYTES_NAME)
.popupMenuGroup(CLEAR_CODE_BYTES_NAME, "1") .popupMenuGroup(CLEAR_CODE_BYTES_NAME, "1")
.keyBinding("C") .keyBinding("C")
.withContext(ListingActionContext.class) .withContext(ListingActionContext.class)
@ -193,7 +194,7 @@ public class ClearPlugin extends Plugin {
new ActionBuilder(CLEAR_WITH_OPTIONS_NAME, getName()) new ActionBuilder(CLEAR_WITH_OPTIONS_NAME, getName())
.menuPath(ToolConstants.MENU_EDIT, CLEAR_WITH_OPTIONS_NAME + "...") .menuPath(ToolConstants.MENU_EDIT, CLEAR_WITH_OPTIONS_NAME + "...")
.menuGroup(CLEAR_CODE_BYTES_NAME, "2") .menuGroup(CLEAR_CODE_BYTES_NAME, "2")
.popupMenuPath(CLEAR_WITH_OPTIONS_NAME + "...") .popupMenuPath(CLEAR_MENU, CLEAR_WITH_OPTIONS_NAME + "...")
.popupMenuGroup(CLEAR_CODE_BYTES_NAME, "2") .popupMenuGroup(CLEAR_CODE_BYTES_NAME, "2")
.withContext(ListingActionContext.class) .withContext(ListingActionContext.class)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES) .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
@ -203,7 +204,7 @@ public class ClearPlugin extends Plugin {
new ActionBuilder(CLEAR_FLOW_AND_REPAIR, getName()) new ActionBuilder(CLEAR_FLOW_AND_REPAIR, getName())
.menuPath(ToolConstants.MENU_EDIT, CLEAR_FLOW_AND_REPAIR + "...") .menuPath(ToolConstants.MENU_EDIT, CLEAR_FLOW_AND_REPAIR + "...")
.menuGroup(CLEAR_CODE_BYTES_NAME, "3") .menuGroup(CLEAR_CODE_BYTES_NAME, "3")
.popupMenuPath(CLEAR_FLOW_AND_REPAIR + "...") .popupMenuPath(CLEAR_MENU, CLEAR_FLOW_AND_REPAIR + "...")
.popupMenuGroup(CLEAR_CODE_BYTES_NAME, "3") .popupMenuGroup(CLEAR_CODE_BYTES_NAME, "3")
.withContext(ListingActionContext.class) .withContext(ListingActionContext.class)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES) .inWindow(ActionBuilder.When.CONTEXT_MATCHES)

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,24 +15,23 @@
*/ */
package ghidra.app.plugin.core.disassembler; package ghidra.app.plugin.core.disassembler;
import docking.action.MenuData;
import ghidra.app.context.ListingActionContext; import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction; import ghidra.app.context.ListingContextAction;
import ghidra.util.HelpLocation; import ghidra.util.HelpLocation;
import docking.action.MenuData;
public class ContextAction extends ListingContextAction { public class ContextAction extends ListingContextAction {
private DisassemblerPlugin plugin; private DisassemblerPlugin plugin;
public ContextAction(DisassemblerPlugin plugin, String groupName) { public ContextAction(DisassemblerPlugin plugin, String groupName) {
super("Processor Options", plugin.getName()); super("Processor Options", plugin.getName());
this.plugin = plugin; this.plugin = plugin;
setPopupMenuData( new MenuData( setMenuBarData(new MenuData(
new String[]{"Processor Options..." }, new String[] { "Tools", "Processor Options..." },
null, null,
groupName ) ); groupName));
setHelpLocation(new HelpLocation("DisassemblerPlugin", "ProcessorOptions")); setHelpLocation(new HelpLocation("DisassemblerPlugin", "ProcessorOptions"));
} }

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,14 +15,13 @@
*/ */
package ghidra.app.plugin.core.disassembler; package ghidra.app.plugin.core.disassembler;
import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction;
import ghidra.program.model.address.Address;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import docking.action.KeyBindingData; import docking.action.KeyBindingData;
import docking.action.MenuData; import docking.action.MenuData;
import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction;
import ghidra.program.model.address.Address;
class DisassembleAction extends ListingContextAction { class DisassembleAction extends ListingContextAction {
private DisassemblerPlugin plugin; private DisassemblerPlugin plugin;
@ -33,8 +31,9 @@ class DisassembleAction extends ListingContextAction {
this.plugin = plugin; this.plugin = plugin;
setPopupMenuData( new MenuData( new String[]{"Disassemble" }, null, groupName ) ); setPopupMenuData(
setKeyBindingData( new KeyBindingData( KeyEvent.VK_D, 0 ) ); new MenuData(new String[] { "Disassemble", "Disassemble" }, null, groupName));
setKeyBindingData(new KeyBindingData(KeyEvent.VK_D, 0));
} }
@Override @Override
@ -45,7 +44,7 @@ class DisassembleAction extends ListingContextAction {
@Override @Override
public boolean isEnabledForContext(ListingActionContext context) { public boolean isEnabledForContext(ListingActionContext context) {
Address address = context.getAddress(); Address address = context.getAddress();
if ( address == null ) { if (address == null) {
return false; return false;
} }
return plugin.checkDisassemblyEnabled(context, address, true); return plugin.checkDisassemblyEnabled(context, address, true);

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,9 +19,9 @@
*/ */
package ghidra.app.plugin.core.disassembler; package ghidra.app.plugin.core.disassembler;
import docking.action.MenuData;
import ghidra.app.context.ListingActionContext; import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction; import ghidra.app.context.ListingContextAction;
import docking.action.MenuData;
/** /**
* *
@ -38,7 +37,8 @@ class RestrictedDisassembleAction extends ListingContextAction {
this.plugin = plugin; this.plugin = plugin;
setPopupMenuData(new MenuData(new String[] { "Disassemble (Restricted)" }, null, groupName)); setPopupMenuData(new MenuData(new String[] { "Disassemble", "Disassemble (Restricted)" },
null, groupName));
} }
@Override @Override

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,9 +19,9 @@
*/ */
package ghidra.app.plugin.core.disassembler; package ghidra.app.plugin.core.disassembler;
import docking.action.MenuData;
import ghidra.app.context.ListingActionContext; import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction; import ghidra.app.context.ListingContextAction;
import docking.action.MenuData;
/** /**
* Action for static disassembly * Action for static disassembly
@ -36,7 +35,8 @@ class StaticDisassembleAction extends ListingContextAction {
this.plugin = plugin; this.plugin = plugin;
setPopupMenuData(new MenuData(new String[] { "Disassemble (Static)" }, null, groupName)); setPopupMenuData(
new MenuData(new String[] { "Disassemble", "Disassemble (Static)" }, null, groupName));
} }
@Override @Override