mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +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.ActionContext;
|
||||||
import docking.action.MenuData;
|
import docking.action.MenuData;
|
||||||
import docking.action.ToggleDockingAction;
|
import docking.action.ToggleDockingAction;
|
||||||
|
import docking.tool.ToolConstants;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
import ghidra.app.services.GraphDisplayBroker;
|
import ghidra.app.services.GraphDisplayBroker;
|
||||||
|
@ -148,7 +149,7 @@ public class GraphDisplayBrokerPlugin extends Plugin
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GraphDisplay getDefaultGraphDisplay(boolean reuseGraph, Map<String, String> properties,
|
public GraphDisplay getDefaultGraphDisplay(boolean reuseGraph, Map<String, String> properties,
|
||||||
TaskMonitor monitor) throws GraphException {
|
TaskMonitor monitor) throws GraphException {
|
||||||
if (defaultGraphDisplayProvider != null) {
|
if (defaultGraphDisplayProvider != null) {
|
||||||
return defaultGraphDisplayProvider.getGraphDisplay(reuseGraph, properties, monitor);
|
return defaultGraphDisplayProvider.getGraphDisplay(reuseGraph, properties, monitor);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,9 @@ public class GraphDisplayBrokerPlugin extends Plugin
|
||||||
super(provider.getName(), owner);
|
super(provider.getName(), owner);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
setMenuBarData(
|
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());
|
setHelpLocation(provider.getHelpLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,24 +15,25 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.reachability;
|
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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
import resources.ResourceManager;
|
|
||||||
import resources.icons.RotateIcon;
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.action.*;
|
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
|
//@formatter:off
|
||||||
@PluginInfo(
|
@PluginInfo(
|
||||||
|
@ -53,7 +54,7 @@ public class FunctionReachabilityPlugin extends ProgramPlugin {
|
||||||
|
|
||||||
private DockingAction showProviderAction;
|
private DockingAction showProviderAction;
|
||||||
private List<FunctionReachabilityProvider> providers =
|
private List<FunctionReachabilityProvider> providers =
|
||||||
new ArrayList<FunctionReachabilityProvider>();
|
new ArrayList<>();
|
||||||
|
|
||||||
public FunctionReachabilityPlugin(PluginTool tool) {
|
public FunctionReachabilityPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool, true, true);
|
||||||
|
@ -86,7 +87,7 @@ public class FunctionReachabilityPlugin extends ProgramPlugin {
|
||||||
"Function Reachability" }, ICON, "ShowReferences"));
|
"Function Reachability" }, ICON, "ShowReferences"));
|
||||||
|
|
||||||
// TODO graph menu?...it is a graph, but not a UI graph
|
// 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));
|
"Function Reachability" }, ICON));
|
||||||
|
|
||||||
// TODO in toolbar menu?
|
// TODO in toolbar menu?
|
||||||
|
|
|
@ -253,7 +253,6 @@ public class GraphExporterDialog extends DialogComponentProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void okCallback() {
|
protected void okCallback() {
|
||||||
AttributedGraphExporter exporter = getSelectedExporter();
|
|
||||||
setLastExportDirectory(getSelectedOutputFile());
|
setLastExportDirectory(getSelectedOutputFile());
|
||||||
if (doExport()) {
|
if (doExport()) {
|
||||||
close();
|
close();
|
||||||
|
@ -273,10 +272,10 @@ public class GraphExporterDialog extends DialogComponentProvider {
|
||||||
File outputFile = getSelectedOutputFile();
|
File outputFile = getSelectedOutputFile();
|
||||||
|
|
||||||
if (outputFile.exists() &&
|
if (outputFile.exists() &&
|
||||||
OptionDialog.showOptionDialog(getComponent(), "Overwrite Existing File?",
|
OptionDialog.showOptionDialog(getComponent(), "Overwrite Existing File?",
|
||||||
"The file " + outputFile + " already exists.\nDo you want to overwrite it?",
|
"The file " + outputFile + " already exists.\nDo you want to overwrite it?",
|
||||||
"Overwrite", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
"Overwrite", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* 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.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* 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.ToggleDockingAction;
|
||||||
import docking.action.builder.ActionBuilder;
|
import docking.action.builder.ActionBuilder;
|
||||||
import docking.action.builder.ToggleActionBuilder;
|
import docking.action.builder.ToggleActionBuilder;
|
||||||
|
import docking.tool.ToolConstants;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.events.ProgramLocationPluginEvent;
|
import ghidra.app.events.ProgramLocationPluginEvent;
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
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
|
* 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.
|
* 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
|
* 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
|
* 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
|
* 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 "
|
+ "Once a graph is created, it uses the currenly selected graph output to display "
|
||||||
+ "or export the graph. The plugin "
|
+ "or export the graph. The plugin "
|
||||||
+ "also provides event handling to facilitate interaction between "
|
+ "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 },
|
servicesRequired = { GoToService.class, BlockModelService.class, GraphDisplayBroker.class },
|
||||||
eventsProduced = { ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.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 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 FORCE_LOCATION_DISPLAY_OPTION = "Force Location Visible on Graph";
|
||||||
private static final String MAX_DEPTH_OPTION = "Max Reference Depth";
|
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;
|
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
|
@Override
|
||||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
|
@ -181,21 +170,23 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
|
|
||||||
new ActionBuilder("Graph Block Flow", getName()).menuPath(MENU_GRAPH, "&Block Flow")
|
new ActionBuilder("Graph Block Flow", getName())
|
||||||
.menuGroup("Graph", "A")
|
.menuPath(MENU_GRAPH, "&Block Flow")
|
||||||
|
.menuGroup(MENU_GRAPH, "A")
|
||||||
.onAction(c -> graphBlockFlow())
|
.onAction(c -> graphBlockFlow())
|
||||||
.enabledWhen(this::canGraph)
|
.enabledWhen(this::canGraph)
|
||||||
.buildAndInstall(tool);
|
.buildAndInstall(tool);
|
||||||
|
|
||||||
new ActionBuilder("Graph Code Flow", getName()).menuPath(MENU_GRAPH, "C&ode Flow")
|
new ActionBuilder("Graph Code Flow", getName())
|
||||||
.menuGroup("Graph", "B")
|
.menuPath(MENU_GRAPH, "C&ode Flow")
|
||||||
|
.menuGroup(MENU_GRAPH, "B")
|
||||||
.onAction(c -> graphCodeFlow())
|
.onAction(c -> graphCodeFlow())
|
||||||
.enabledWhen(this::canGraph)
|
.enabledWhen(this::canGraph)
|
||||||
.buildAndInstall(tool);
|
.buildAndInstall(tool);
|
||||||
|
|
||||||
new ActionBuilder("Graph Calls Using Default Model", getName())
|
new ActionBuilder("Graph Calls Using Default Model", getName())
|
||||||
.menuPath(MENU_GRAPH, "&Calls")
|
.menuPath(MENU_GRAPH, "&Calls")
|
||||||
.menuGroup("Graph", "C")
|
.menuGroup(MENU_GRAPH, "C")
|
||||||
.onAction(c -> graphSubroutines())
|
.onAction(c -> graphSubroutines())
|
||||||
.enabledWhen(this::canGraph)
|
.enabledWhen(this::canGraph)
|
||||||
.buildAndInstall(tool);
|
.buildAndInstall(tool);
|
||||||
|
@ -228,7 +219,8 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
||||||
.buildAndInstall(tool);
|
.buildAndInstall(tool);
|
||||||
|
|
||||||
reuseGraphAction =
|
reuseGraphAction =
|
||||||
new ToggleActionBuilder("Reuse Graph", getName()).menuPath(MENU_GRAPH, "Reuse Graph")
|
new ToggleActionBuilder("Reuse Graph", getName())
|
||||||
|
.menuPath(MENU_GRAPH, "Reuse Graph")
|
||||||
.menuGroup("Graph Options")
|
.menuGroup("Graph Options")
|
||||||
.selected(reuseGraph)
|
.selected(reuseGraph)
|
||||||
.onAction(c -> reuseGraph = reuseGraphAction.isSelected())
|
.onAction(c -> reuseGraph = reuseGraphAction.isSelected())
|
||||||
|
@ -236,7 +228,8 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
||||||
.buildAndInstall(tool);
|
.buildAndInstall(tool);
|
||||||
|
|
||||||
appendGraphAction =
|
appendGraphAction =
|
||||||
new ToggleActionBuilder("Append Graph", getName()).menuPath(MENU_GRAPH, "Append Graph")
|
new ToggleActionBuilder("Append Graph", getName())
|
||||||
|
.menuPath(MENU_GRAPH, "Append Graph")
|
||||||
.menuGroup("Graph Options")
|
.menuGroup("Graph Options")
|
||||||
.selected(false)
|
.selected(false)
|
||||||
.onAction(c -> updateAppendAndReuseGraph())
|
.onAction(c -> updateAppendAndReuseGraph())
|
||||||
|
|
|
@ -63,6 +63,11 @@ public interface ToolConstants extends DockingToolConstants {
|
||||||
*/
|
*/
|
||||||
public static final String MENU_ANALYSIS = "&Analysis";
|
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
|
* Used when placing an action in the "Project" menu of the tool
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue