Ghidra is a software reverse engineering (SRE) framework
GP-1244 - Fixed missing Graph menu mnemonic
dragonmachera89f27c99471
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/GraphDisplayBrokerPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/GraphDisplayBrokerPlugin.javaindex dd3d6e7a42..b5ae98fe20 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/GraphDisplayBrokerPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/GraphDisplayBrokerPlugin.java@@ -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@Overridepublic 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 Pluginsuper(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());}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.javaindex 52ff9f3b0c..4cb38f2190 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.java@@ -15,24 +15,25 @@*/package ghidra.app.plugin.core.reachability;+import java.util.ArrayList;+import java.util.List;++import javax.swing.Icon;++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.*;+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 java.util.ArrayList;-import java.util.List;--import javax.swing.Icon;-import resources.ResourceManager;import resources.icons.RotateIcon;-import docking.ActionContext;-import docking.action.*;//@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?diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.javaindex 4e29276969..84d6284c22 100644--- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.java+++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.java@@ -253,7 +253,6 @@ public class GraphExporterDialog extends DialogComponentProvider {@Overrideprotected 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 {diff --git a/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.java b/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.javaindex d9fac4b83b..a285abfe25 100644--- a/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.java+++ b/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.java@@ -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.@@ -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 ProgramPluginprivate 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- */@Overridepublic void optionsChanged(ToolOptions options, String optionName, Object oldValue,Object newValue) {@@ -181,21 +170,23 @@ public class ProgramGraphPlugin extends ProgramPluginprivate 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())diff --git a/Ghidra/Framework/Docking/src/main/java/docking/tool/ToolConstants.java b/Ghidra/Framework/Docking/src/main/java/docking/tool/ToolConstants.javaindex f5712c2c07..2a22afc146 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/tool/ToolConstants.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/tool/ToolConstants.java@@ -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*/