mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GP-3402 - Updated the Graph service API to better manage concurrent
threaded accesses
This commit is contained in:
parent
de55e42686
commit
bde74ad4d3
12 changed files with 422 additions and 387 deletions
|
@ -19,11 +19,6 @@ import java.util.Set;
|
|||
|
||||
public class DummyGraphDisplayListener implements GraphDisplayListener {
|
||||
|
||||
@Override
|
||||
public void graphClosed() {
|
||||
// I'm a dummy
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphDisplayListener cloneWith(GraphDisplay graphDisplay) {
|
||||
return new DummyGraphDisplayListener();
|
||||
|
@ -31,17 +26,17 @@ public class DummyGraphDisplayListener implements GraphDisplayListener {
|
|||
|
||||
@Override
|
||||
public void selectionChanged(Set<AttributedVertex> vertices) {
|
||||
// I'm a dummy
|
||||
// stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locationFocusChanged(AttributedVertex vertex) {
|
||||
// I'm a dummy
|
||||
// stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// I'm a dummy
|
||||
// stub
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,74 +30,18 @@ import ghidra.util.task.TaskMonitor;
|
|||
* closed.
|
||||
*/
|
||||
public interface GraphDisplay {
|
||||
public static final int ALIGN_LEFT = 0; // aligns graph text to the left
|
||||
public static final int ALIGN_CENTER = 1; // aligns graph text to the center
|
||||
public static final int ALIGN_RIGHT = 2; // aligns graph text to the right
|
||||
|
||||
/**
|
||||
* values are color names or rgb in hex '0xFF0000' is red
|
||||
*/
|
||||
public static final String SELECTED_VERTEX_COLOR = "selectedVertexColor";
|
||||
|
||||
/**
|
||||
* values are color names or rgb in hex '0xFF0000' is red
|
||||
*/
|
||||
public static final String SELECTED_EDGE_COLOR = "selectedEdgeColor";
|
||||
|
||||
/**
|
||||
* values are defined as String symbols in LayoutFunction class
|
||||
*
|
||||
* KAMADA_KAWAI,FRUCTERMAN_REINGOLD,CIRCLE_MINCROSS,TIDIER_TREE,TIDIER_RADIAL_TREE,
|
||||
* MIN_CROSS_TOP_DOWN,MIN_CROSS_LONGEST_PATH,MIN_CROSS_NETWORK_SIMPLEX,MIN_CROSS_COFFMAN_GRAHAM,
|
||||
* EXP_MIN_CROSS_TOP_DOWN,EXP_MIN_CROSS_LONGEST_PATH,EXP_MIN_CROSS_NETWORK_SIMPLEX,
|
||||
* EXP_MIN_CROSS_COFFMAN_GRAHAM,TREE,RADIAL,BALLOON,GEM
|
||||
*
|
||||
* may have no meaning for a different graph visualization library
|
||||
*/
|
||||
public static final String INITIAL_LAYOUT_ALGORITHM = "initialLayoutAlgorithm";
|
||||
|
||||
/**
|
||||
* true or false
|
||||
* may have no meaning for a different graph visualization library
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public static final String ENABLE_EDGE_SELECTION = "enableEdgeSelection";
|
||||
|
||||
/**
|
||||
* a comma-separated list of edge type names in priority order
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public static final String FAVORED_EDGES = "favoredEdges";
|
||||
|
||||
/**
|
||||
* Sets a {@link GraphDisplayListener} to be notified when the user changes the vertex focus
|
||||
* or selects one or more nodes in a graph window
|
||||
*
|
||||
*
|
||||
* @param listener the listener to be notified
|
||||
*/
|
||||
public void setGraphDisplayListener(GraphDisplayListener listener);
|
||||
|
||||
/**
|
||||
* Tells the graph display window to focus the vertex with the given id
|
||||
*
|
||||
*
|
||||
* @param vertex the vertex to focus
|
||||
* @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
|
||||
|
@ -116,14 +60,14 @@ public interface GraphDisplay {
|
|||
|
||||
/**
|
||||
* Returns the currently focused vertex or null if no vertex is focused
|
||||
*
|
||||
*
|
||||
* @return the currently focused vertex or null if no vertex is focused
|
||||
*/
|
||||
public AttributedVertex getFocusedVertex();
|
||||
|
||||
/**
|
||||
* Tells the graph display window to select the vertices with the given ids
|
||||
*
|
||||
*
|
||||
* @param vertexSet the set of vertices to select
|
||||
* @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
|
||||
|
@ -136,7 +80,7 @@ public interface GraphDisplay {
|
|||
|
||||
/**
|
||||
* Returns a set of vertex ids for all the currently selected vertices
|
||||
*
|
||||
*
|
||||
* @return a set of vertex ids for all the currently selected vertices
|
||||
*/
|
||||
public Set<AttributedVertex> getSelectedVertices();
|
||||
|
@ -148,7 +92,7 @@ public interface GraphDisplay {
|
|||
|
||||
/**
|
||||
* Sets the graph to be displayed or consumed by this graph display
|
||||
*
|
||||
*
|
||||
* @param graph the graph to display or consume
|
||||
* @param title a title for the graph
|
||||
* @param monitor a {@link TaskMonitor} which can be used to cancel the graphing operation
|
||||
|
@ -156,6 +100,7 @@ public interface GraphDisplay {
|
|||
* @throws CancelledException thrown if the graphing operation was cancelled
|
||||
* @deprecated You should now use the form that takes in a {@link GraphDisplayOptions}
|
||||
*/
|
||||
@Deprecated
|
||||
public default void setGraph(AttributedGraph graph, String title, boolean append,
|
||||
TaskMonitor monitor) throws CancelledException {
|
||||
setGraph(graph, new GraphDisplayOptions(graph.getGraphType()), title, append, monitor);
|
||||
|
@ -163,7 +108,7 @@ public interface GraphDisplay {
|
|||
|
||||
/**
|
||||
* Sets the graph to be displayed or consumed by this graph display
|
||||
*
|
||||
*
|
||||
* @param graph the graph to display or consume
|
||||
* @param options {@link GraphDisplayOptions} for configuring how the display will
|
||||
* render vertices and edges based on there vertex type and edge type respectively.
|
||||
|
@ -182,7 +127,7 @@ public interface GraphDisplay {
|
|||
|
||||
/**
|
||||
* Updates a vertex to a new name
|
||||
*
|
||||
*
|
||||
* @param vertex the vertex to rename
|
||||
* @param newName the new name for the vertex
|
||||
*/
|
||||
|
@ -190,7 +135,7 @@ public interface GraphDisplay {
|
|||
|
||||
/**
|
||||
* Returns the title of the current graph
|
||||
*
|
||||
*
|
||||
* @return the title of the current graph
|
||||
*/
|
||||
public String getGraphTitle();
|
||||
|
@ -198,7 +143,7 @@ public interface GraphDisplay {
|
|||
/**
|
||||
* Adds the action to the graph display. Not all GraphDisplays support adding custom
|
||||
* actions, so this may have no effect.
|
||||
*
|
||||
*
|
||||
* @param action the action to add
|
||||
*/
|
||||
public void addAction(DockingActionIf action);
|
||||
|
|
|
@ -21,14 +21,10 @@ import java.util.Set;
|
|||
* Interface for being notified when the user interacts with a visual graph display
|
||||
*/
|
||||
public interface GraphDisplayListener {
|
||||
/**
|
||||
* Notification that the graph window has been closed
|
||||
*/
|
||||
public void graphClosed();
|
||||
|
||||
/**
|
||||
* Notification that the set of selected vertices has changed
|
||||
*
|
||||
*
|
||||
* @param vertices the set of currently selected vertices
|
||||
*/
|
||||
public void selectionChanged(Set<AttributedVertex> vertices);
|
||||
|
@ -42,7 +38,7 @@ public interface GraphDisplayListener {
|
|||
/**
|
||||
* Makes a new GraphDisplayListener of the same type as the specific
|
||||
* instance of this GraphDisplayListener
|
||||
*
|
||||
*
|
||||
* @param graphDisplay the new {@link GraphDisplay} the new listener will support
|
||||
* @return A new instance of a GraphDisplayListener that is the same type as as the instance
|
||||
* on which it is called
|
||||
|
@ -50,7 +46,8 @@ public interface GraphDisplayListener {
|
|||
public GraphDisplayListener cloneWith(GraphDisplay graphDisplay);
|
||||
|
||||
/**
|
||||
* Tells the listener that it is no longer needed and it can release any listeners/resources
|
||||
* Tells the listener that it is no longer needed and it can release any listeners/resources.
|
||||
* This will be called when a {@link GraphDisplay} is disposed or if this listener is replaced.
|
||||
*/
|
||||
public void dispose();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue