mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-1244 - Fixed missing Graph menu mnemonic
This commit is contained in:
parent
a32326571f
commit
a89f27c994
5 changed files with 45 additions and 44 deletions
|
@ -20,6 +20,7 @@ import java.util.*;
|
|||
import docking.ActionContext;
|
||||
import docking.action.MenuData;
|
||||
import docking.action.ToggleDockingAction;
|
||||
import docking.tool.ToolConstants;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.services.GraphDisplayBroker;
|
||||
|
@ -148,7 +149,7 @@ public class GraphDisplayBrokerPlugin extends Plugin
|
|||
|
||||
@Override
|
||||
public GraphDisplay getDefaultGraphDisplay(boolean reuseGraph, Map<String, String> properties,
|
||||
TaskMonitor monitor) throws GraphException {
|
||||
TaskMonitor monitor) throws GraphException {
|
||||
if (defaultGraphDisplayProvider != null) {
|
||||
return defaultGraphDisplayProvider.getGraphDisplay(reuseGraph, properties, monitor);
|
||||
}
|
||||
|
@ -177,7 +178,9 @@ public class GraphDisplayBrokerPlugin extends Plugin
|
|||
super(provider.getName(), owner);
|
||||
this.provider = provider;
|
||||
setMenuBarData(
|
||||
new MenuData(new String[] { "Graph", "Graph Output", provider.getName() }, "z"));
|
||||
new MenuData(
|
||||
new String[] { ToolConstants.MENU_GRAPH, "Graph Output", provider.getName() },
|
||||
"z"));
|
||||
setHelpLocation(provider.getHelpLocation());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,24 +15,25 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.reachability;
|
||||
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import resources.ResourceManager;
|
||||
import resources.icons.RotateIcon;
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.tool.ToolConstants;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
import resources.ResourceManager;
|
||||
import resources.icons.RotateIcon;
|
||||
|
||||
//@formatter:off
|
||||
@PluginInfo(
|
||||
|
@ -53,7 +54,7 @@ public class FunctionReachabilityPlugin extends ProgramPlugin {
|
|||
|
||||
private DockingAction showProviderAction;
|
||||
private List<FunctionReachabilityProvider> providers =
|
||||
new ArrayList<FunctionReachabilityProvider>();
|
||||
new ArrayList<>();
|
||||
|
||||
public FunctionReachabilityPlugin(PluginTool tool) {
|
||||
super(tool, true, true);
|
||||
|
@ -86,7 +87,7 @@ public class FunctionReachabilityPlugin extends ProgramPlugin {
|
|||
"Function Reachability" }, ICON, "ShowReferences"));
|
||||
|
||||
// TODO graph menu?...it is a graph, but not a UI graph
|
||||
showProviderAction.setMenuBarData(new MenuData(new String[] { "Graph",
|
||||
showProviderAction.setMenuBarData(new MenuData(new String[] { ToolConstants.MENU_GRAPH,
|
||||
"Function Reachability" }, ICON));
|
||||
|
||||
// TODO in toolbar menu?
|
||||
|
|
|
@ -253,7 +253,6 @@ public class GraphExporterDialog extends DialogComponentProvider {
|
|||
|
||||
@Override
|
||||
protected void okCallback() {
|
||||
AttributedGraphExporter exporter = getSelectedExporter();
|
||||
setLastExportDirectory(getSelectedOutputFile());
|
||||
if (doExport()) {
|
||||
close();
|
||||
|
@ -273,10 +272,10 @@ public class GraphExporterDialog extends DialogComponentProvider {
|
|||
File outputFile = getSelectedOutputFile();
|
||||
|
||||
if (outputFile.exists() &&
|
||||
OptionDialog.showOptionDialog(getComponent(), "Overwrite Existing File?",
|
||||
"The file " + outputFile + " already exists.\nDo you want to overwrite it?",
|
||||
"Overwrite", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||
return false;
|
||||
OptionDialog.showOptionDialog(getComponent(), "Overwrite Existing File?",
|
||||
"The file " + outputFile + " already exists.\nDo you want to overwrite it?",
|
||||
"Overwrite", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -23,6 +23,7 @@ import docking.action.DockingAction;
|
|||
import docking.action.ToggleDockingAction;
|
||||
import docking.action.builder.ActionBuilder;
|
||||
import docking.action.builder.ToggleActionBuilder;
|
||||
import docking.tool.ToolConstants;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramLocationPluginEvent;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
|
@ -44,7 +45,7 @@ import ghidra.util.task.TaskLauncher;
|
|||
/**
|
||||
* Plugin for generating program graphs. It uses the GraphServiceBroker to consume/display
|
||||
* the graphs that it generates. This plugin generates several different types of program graphs.
|
||||
* Both the "Block flow" and "code flow" actions generate graph of basic block flows. The only
|
||||
* Both the "block flow" and "code flow" actions will generate a graph of basic block flows. The only
|
||||
* difference is that the "code flow" action generates a graph that
|
||||
* displays the assembly for for each basic block, whereas the "block flow" action generates a graph
|
||||
* that displays the symbol or address at the start of the basic block. This plugin also
|
||||
|
@ -62,7 +63,7 @@ import ghidra.util.task.TaskLauncher;
|
|||
+ "Once a graph is created, it uses the currenly selected graph output to display "
|
||||
+ "or export the graph. The plugin "
|
||||
+ "also provides event handling to facilitate interaction between "
|
||||
+ "the graph and the tool.",
|
||||
+ "the graph and the tool.",
|
||||
servicesRequired = { GoToService.class, BlockModelService.class, GraphDisplayBroker.class },
|
||||
eventsProduced = { ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.class }
|
||||
)
|
||||
|
@ -74,7 +75,7 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
|||
private static final String GRAPH_ENTRY_POINT_NEXUS = "Graph Entry Point Nexus";
|
||||
private static final String FORCE_LOCATION_DISPLAY_OPTION = "Force Location Visible on Graph";
|
||||
private static final String MAX_DEPTH_OPTION = "Max Reference Depth";
|
||||
public static final String MENU_GRAPH = "&Graph";
|
||||
public static final String MENU_GRAPH = ToolConstants.MENU_GRAPH;
|
||||
|
||||
private BlockModelService blockModelService;
|
||||
|
||||
|
@ -149,18 +150,6 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that an option changed.
|
||||
*
|
||||
* @param options
|
||||
* options object containing the property that changed
|
||||
* @param optionName
|
||||
* name of option that changed
|
||||
* @param oldValue
|
||||
* old value of the option
|
||||
* @param newValue
|
||||
* new value of the option
|
||||
*/
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
|
@ -181,21 +170,23 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
|||
|
||||
private void createActions() {
|
||||
|
||||
new ActionBuilder("Graph Block Flow", getName()).menuPath(MENU_GRAPH, "&Block Flow")
|
||||
.menuGroup("Graph", "A")
|
||||
new ActionBuilder("Graph Block Flow", getName())
|
||||
.menuPath(MENU_GRAPH, "&Block Flow")
|
||||
.menuGroup(MENU_GRAPH, "A")
|
||||
.onAction(c -> graphBlockFlow())
|
||||
.enabledWhen(this::canGraph)
|
||||
.buildAndInstall(tool);
|
||||
|
||||
new ActionBuilder("Graph Code Flow", getName()).menuPath(MENU_GRAPH, "C&ode Flow")
|
||||
.menuGroup("Graph", "B")
|
||||
new ActionBuilder("Graph Code Flow", getName())
|
||||
.menuPath(MENU_GRAPH, "C&ode Flow")
|
||||
.menuGroup(MENU_GRAPH, "B")
|
||||
.onAction(c -> graphCodeFlow())
|
||||
.enabledWhen(this::canGraph)
|
||||
.buildAndInstall(tool);
|
||||
|
||||
new ActionBuilder("Graph Calls Using Default Model", getName())
|
||||
.menuPath(MENU_GRAPH, "&Calls")
|
||||
.menuGroup("Graph", "C")
|
||||
.menuGroup(MENU_GRAPH, "C")
|
||||
.onAction(c -> graphSubroutines())
|
||||
.enabledWhen(this::canGraph)
|
||||
.buildAndInstall(tool);
|
||||
|
@ -228,7 +219,8 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
|||
.buildAndInstall(tool);
|
||||
|
||||
reuseGraphAction =
|
||||
new ToggleActionBuilder("Reuse Graph", getName()).menuPath(MENU_GRAPH, "Reuse Graph")
|
||||
new ToggleActionBuilder("Reuse Graph", getName())
|
||||
.menuPath(MENU_GRAPH, "Reuse Graph")
|
||||
.menuGroup("Graph Options")
|
||||
.selected(reuseGraph)
|
||||
.onAction(c -> reuseGraph = reuseGraphAction.isSelected())
|
||||
|
@ -236,7 +228,8 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
|||
.buildAndInstall(tool);
|
||||
|
||||
appendGraphAction =
|
||||
new ToggleActionBuilder("Append Graph", getName()).menuPath(MENU_GRAPH, "Append Graph")
|
||||
new ToggleActionBuilder("Append Graph", getName())
|
||||
.menuPath(MENU_GRAPH, "Append Graph")
|
||||
.menuGroup("Graph Options")
|
||||
.selected(false)
|
||||
.onAction(c -> updateAppendAndReuseGraph())
|
||||
|
|
|
@ -63,6 +63,11 @@ public interface ToolConstants extends DockingToolConstants {
|
|||
*/
|
||||
public static final String MENU_ANALYSIS = "&Analysis";
|
||||
|
||||
/**
|
||||
* Used when placing an action in the "Graph" menu of the tool
|
||||
*/
|
||||
public static final String MENU_GRAPH = "&Graph";
|
||||
|
||||
/**
|
||||
* Used when placing an action in the "Project" menu of the tool
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue