GP-306 fixing graph titles

This commit is contained in:
ghidravore 2020-10-23 18:09:29 -04:00
parent 1c145dd781
commit d2e0b350f4
10 changed files with 43 additions and 33 deletions

View file

@ -153,7 +153,7 @@ public class BlockGraphTask extends Task {
display.setVertexLabel(CODE_ATTRIBUTE, GraphDisplay.ALIGN_LEFT, 12, true,
codeLimitPerBlock + 1);
}
display.setGraph(graph, actionName, appendGraph, monitor);
display.setGraph(graph, getDescription(), appendGraph, monitor);
if (location != null) {
// initialize the graph location, but don't have the graph send an event
@ -175,6 +175,17 @@ public class BlockGraphTask extends Task {
}
}
private String getDescription() {
String description = actionName;
if (selection != null && !selection.isEmpty()) {
description += ": " + selection.getMinAddress();
}
else {
description += " (Entire Program)";
}
return description;
}
/**
* Set the maximum number of code lines which will be used per block when
* showCode is enabled.

View file

@ -277,11 +277,11 @@ public class ProgramGraphPlugin extends ProgramPlugin
}
private void graphBlockFlow() {
graph("Flow Graph", blockModelService.getActiveBlockModelName(), false);
graph("Block Flow Graph", blockModelService.getActiveBlockModelName(), false);
}
private void graphCodeFlow() {
graph("Code Graph", blockModelService.getActiveBlockModelName(), true);
graph("Code Flow Graph", blockModelService.getActiveBlockModelName(), true);
}
private void graphSubroutines() {
@ -289,7 +289,7 @@ public class ProgramGraphPlugin extends ProgramPlugin
}
private void graphSubroutinesUsing(String modelName) {
graph("Call Graph", modelName, false);
graph("Call Graph (" + modelName + ")", modelName, false);
}
private void graph(String actionName, String modelName, boolean showCode) {

View file

@ -28,7 +28,7 @@ public class TestGraphDisplay implements GraphDisplay {
private Set<String> definedVertexAttributes = new HashSet<>();
private Set<String> definedEdgeAttributes = new HashSet<>();
private AttributedGraph graph;
private String graphDescription;
private String title;
private GraphDisplayListener listener;
private AttributedVertex focusedVertex;
private Set<AttributedVertex> currentSelection;
@ -80,11 +80,11 @@ public class TestGraphDisplay implements GraphDisplay {
}
@Override
public void setGraph(AttributedGraph graph, String description, boolean append,
public void setGraph(AttributedGraph graph, String title, boolean append,
TaskMonitor monitor)
throws CancelledException {
this.graph = graph;
this.graphDescription = description;
this.title = title;
}
@Override
@ -98,8 +98,8 @@ public class TestGraphDisplay implements GraphDisplay {
}
@Override
public String getGraphDescription() {
return graphDescription;
public String getGraphTitle() {
return title;
}
@Override