Merge remote-tracking branch

'origin/GP-5052-dragonmacher-context-menu-update--SQUASHED'
(Closes #7021, Closes #566)
This commit is contained in:
Ryan Kurtz 2024-10-29 12:49:08 -04:00
commit d026dd2316
6 changed files with 51 additions and 55 deletions

View File

@ -53,7 +53,7 @@
<LI>Right-mouse-click</LI>
<LI>Select Disassembly</LI>
<LI>Select Disassemble <IMG SRC="help/shared/arrow.gif" /> Disassemble</LI>
</OL>
<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>Select Disassemble (Static).</LI>
<LI>Select Disassemble <IMG SRC="help/shared/arrow.gif" /> Disassemble (Static).</LI>
</OL>
<P>The disassembly progress is displayed in the progress status area (bottom right) of the
@ -152,7 +152,7 @@
<OL>
<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>
<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>
<OL>
<LI>Place the cursor in the Code Browser.</LI>
<LI>Right-mouse-click, and select the "Processor Options" menu item.</LI>
<LI>Select Tools <IMG SRC="help/shared/arrow.gif" /> Processor Options... </LI>
<LI>Enter the values and press the "Ok" button.<BR>
</LI>

View File

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -42,6 +42,7 @@ import ghidra.program.util.*;
)
//@formatter:on
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_CODE_BYTES_NAME = "Clear Code Bytes";
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())
.menuPath(ToolConstants.MENU_EDIT, CLEAR_CODE_BYTES_NAME)
.menuGroup(CLEAR_CODE_BYTES_NAME, "1")
.popupMenuPath(CLEAR_CODE_BYTES_NAME)
.popupMenuPath(CLEAR_MENU, CLEAR_CODE_BYTES_NAME)
.popupMenuGroup(CLEAR_CODE_BYTES_NAME, "1")
.keyBinding("C")
.withContext(ListingActionContext.class)
@ -193,7 +194,7 @@ public class ClearPlugin extends Plugin {
new ActionBuilder(CLEAR_WITH_OPTIONS_NAME, getName())
.menuPath(ToolConstants.MENU_EDIT, CLEAR_WITH_OPTIONS_NAME + "...")
.menuGroup(CLEAR_CODE_BYTES_NAME, "2")
.popupMenuPath(CLEAR_WITH_OPTIONS_NAME + "...")
.popupMenuPath(CLEAR_MENU, CLEAR_WITH_OPTIONS_NAME + "...")
.popupMenuGroup(CLEAR_CODE_BYTES_NAME, "2")
.withContext(ListingActionContext.class)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
@ -203,7 +204,7 @@ public class ClearPlugin extends Plugin {
new ActionBuilder(CLEAR_FLOW_AND_REPAIR, getName())
.menuPath(ToolConstants.MENU_EDIT, CLEAR_FLOW_AND_REPAIR + "...")
.menuGroup(CLEAR_CODE_BYTES_NAME, "3")
.popupMenuPath(CLEAR_FLOW_AND_REPAIR + "...")
.popupMenuPath(CLEAR_MENU, CLEAR_FLOW_AND_REPAIR + "...")
.popupMenuGroup(CLEAR_CODE_BYTES_NAME, "3")
.withContext(ListingActionContext.class)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)

View File

@ -1,13 +1,12 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -16,35 +15,34 @@
*/
package ghidra.app.plugin.core.disassembler;
import docking.action.MenuData;
import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction;
import ghidra.util.HelpLocation;
import docking.action.MenuData;
public class ContextAction extends ListingContextAction {
private DisassemblerPlugin plugin;
public ContextAction(DisassemblerPlugin plugin, String groupName) {
super("Processor Options", plugin.getName());
this.plugin = plugin;
setPopupMenuData( new MenuData(
new String[]{"Processor Options..." },
null,
groupName ) );
setMenuBarData(new MenuData(
new String[] { "Tools", "Processor Options..." },
null,
groupName));
setHelpLocation(new HelpLocation("DisassemblerPlugin", "ProcessorOptions"));
}
@Override
public void actionPerformed(ListingActionContext context) {
public void actionPerformed(ListingActionContext context) {
plugin.setDefaultContext(context);
}
@Override
public boolean isEnabledForContext(ListingActionContext context) {
public boolean isEnabledForContext(ListingActionContext context) {
return plugin.hasContextRegisters(context.getProgram());
}

View File

@ -1,13 +1,12 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -16,39 +15,39 @@
*/
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 docking.action.KeyBindingData;
import docking.action.MenuData;
import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction;
import ghidra.program.model.address.Address;
class DisassembleAction extends ListingContextAction {
private DisassemblerPlugin plugin;
public DisassembleAction(DisassemblerPlugin plugin, String groupName) {
super("Disassemble", plugin.getName());
this.plugin = plugin;
setPopupMenuData( new MenuData( new String[]{"Disassemble" }, null, groupName ) );
setKeyBindingData( new KeyBindingData( KeyEvent.VK_D, 0 ) );
setPopupMenuData(
new MenuData(new String[] { "Disassemble", "Disassemble" }, null, groupName));
setKeyBindingData(new KeyBindingData(KeyEvent.VK_D, 0));
}
@Override
public void actionPerformed(ListingActionContext context) {
public void actionPerformed(ListingActionContext context) {
plugin.disassembleCallback(context);
}
@Override
public boolean isEnabledForContext(ListingActionContext context) {
public boolean isEnabledForContext(ListingActionContext context) {
Address address = context.getAddress();
if ( address == null ) {
return false;
if (address == null) {
return false;
}
return plugin.checkDisassemblyEnabled(context, address, true);
return plugin.checkDisassemblyEnabled(context, address, true);
}
}

View File

@ -1,13 +1,12 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -20,9 +19,9 @@
*/
package ghidra.app.plugin.core.disassembler;
import docking.action.MenuData;
import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction;
import docking.action.MenuData;
/**
*
@ -38,7 +37,8 @@ class RestrictedDisassembleAction extends ListingContextAction {
this.plugin = plugin;
setPopupMenuData(new MenuData(new String[] { "Disassemble (Restricted)" }, null, groupName));
setPopupMenuData(new MenuData(new String[] { "Disassemble", "Disassemble (Restricted)" },
null, groupName));
}
@Override

View File

@ -1,13 +1,12 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -20,9 +19,9 @@
*/
package ghidra.app.plugin.core.disassembler;
import docking.action.MenuData;
import ghidra.app.context.ListingActionContext;
import ghidra.app.context.ListingContextAction;
import docking.action.MenuData;
/**
* Action for static disassembly
@ -36,7 +35,8 @@ class StaticDisassembleAction extends ListingContextAction {
this.plugin = plugin;
setPopupMenuData(new MenuData(new String[] { "Disassemble (Static)" }, null, groupName));
setPopupMenuData(
new MenuData(new String[] { "Disassemble", "Disassemble (Static)" }, null, groupName));
}
@Override