Merge remote-tracking branch

'origin/GP-1804-dragonmacher-graph-api-addition--SQUASHED' into patch
(Closes #4060)
This commit is contained in:
Ryan Kurtz 2022-03-16 08:20:18 -04:00
commit cf95afc23d
8 changed files with 169 additions and 116 deletions

View file

@ -26,7 +26,7 @@ import ghidra.util.task.TaskMonitor;
* Interface for objects that display (or consume) graphs. Normally, a graph display represents
* a visual component for displaying and interacting with a graph. Some implementation may not
* be a visual component, but instead consumes/processes the graph (i.e. graph exporter). In this
* case, there is no interactive element and once the graph has been set on the display, it is
* case, there is no interactive element and once the graph has been set on the display, it is
* closed.
*/
public interface GraphDisplay {
@ -37,11 +37,13 @@ public interface GraphDisplay {
/**
* values are color names or rgb in hex '0xFF0000' is red
*/
String SELECTED_VERTEX_COLOR = "selectedVertexColor";
public static final String SELECTED_VERTEX_COLOR = "selectedVertexColor";
/**
* values are color names or rgb in hex '0xFF0000' is red
*/
String SELECTED_EDGE_COLOR = "selectedEdgeColor";
public static final String SELECTED_EDGE_COLOR = "selectedEdgeColor";
/**
* values are defined as String symbols in LayoutFunction class
*
@ -52,33 +54,38 @@ public interface GraphDisplay {
*
* may have no meaning for a different graph visualization library
*/
String INITIAL_LAYOUT_ALGORITHM = "initialLayoutAlgorithm";
public static final String INITIAL_LAYOUT_ALGORITHM = "initialLayoutAlgorithm";
/**
* true or false
* may have no meaning for a different graph visualization library
*/
String DISPLAY_VERTICES_AS_ICONS = "displayVerticesAsIcons";
public static final String DISPLAY_VERTICES_AS_ICONS = "displayVerticesAsIcons";
/**
* values are the strings N,NE,E,SE,S,SW,W,NW,AUTO,CNTR
* may have no meaning for a different graph visualization library
*/
String VERTEX_LABEL_POSITION = "vertexLabelPosition";
public static final String VERTEX_LABEL_POSITION = "vertexLabelPosition";
/**
* true or false, whether edge selection via a mouse click is enabled.
* May not be supported by another graph visualization library
*/
String ENABLE_EDGE_SELECTION = "enableEdgeSelection";
public static final String ENABLE_EDGE_SELECTION = "enableEdgeSelection";
/**
* a comma-separated list of edge type names in priority order
*/
String EDGE_TYPE_PRIORITY_LIST = "edgeTypePriorityList";
public static final String EDGE_TYPE_PRIORITY_LIST = "edgeTypePriorityList";
/**
* a comma-separated list of edge type names.
* any will be considered a favored edge for the min-cross layout
* algorithms.
* May have no meaning with a different graph visualization library
*/
String FAVORED_EDGES = "favoredEdges";
public static final String FAVORED_EDGES = "favoredEdges";
/**
* Sets a {@link GraphDisplayListener} to be notified when the user changes the vertex focus
@ -121,7 +128,7 @@ public interface GraphDisplay {
* @param eventTrigger Provides a hint to the GraphDisplay as to why we are updating the
* graph location so that the GraphDisplay can decide if it should send out a notification via
* the {@link GraphDisplayListener#selectionChanged(Set)}. For example, if we are updating
* the the location due to an event from the main application, we don't want to notify the
* the the location due to an event from the main application, we don't want to notify the
* application the graph changed to avoid event cycles. See {@link EventTrigger} for more
* information.
*/
@ -153,6 +160,7 @@ public interface GraphDisplay {
TaskMonitor monitor) throws CancelledException {
setGraph(graph, new GraphDisplayOptions(graph.getGraphType()), title, append, monitor);
}
/**
* Sets the graph to be displayed or consumed by this graph display
*

View file

@ -15,6 +15,8 @@
*/
package ghidra.service.graph;
import java.util.List;
import ghidra.framework.options.Options;
import ghidra.framework.plugintool.PluginTool;
import ghidra.util.HelpLocation;
@ -38,11 +40,28 @@ public interface GraphDisplayProvider extends ExtensionPoint {
*
* @param reuseGraph if true, this provider will attempt to re-use an existing GraphDisplay
* @param monitor the {@link TaskMonitor} that can be used to monitor and cancel the operation
* @return A GraphDisplay that can be used to display (or otherwise consume - e.g. export) the graph
* @return an object that can be used to display or otherwise consume (e.g., export) the graph
* @throws GraphException thrown if there is a problem creating a GraphDisplay
*/
public GraphDisplay getGraphDisplay(boolean reuseGraph, TaskMonitor monitor) throws GraphException;
public GraphDisplay getGraphDisplay(boolean reuseGraph, TaskMonitor monitor)
throws GraphException;
/**
* Returns the active graph display or null if there is no active graph display. If only one
* graph is displayed, then that graph will be returned. If multiple graphs are being
* displayed, then the most recently shown graph will be displayed, regardless of whether that
* is the active graph in terms of user interaction.
*
* @return the active graph display or null if there is no active graph display.
*/
public GraphDisplay getActiveGraphDisplay();
/**
* Returns all known graph displays. Typically they will be ordered by use, most recently
* first.
* @return the displays
*/
public List<GraphDisplay> getAllGraphDisplays();
/**
* Provides an opportunity for this provider to register and read tool options