mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
b23c8ca435
11 changed files with 60 additions and 31 deletions
|
@ -125,8 +125,15 @@ public abstract class AbstractGraphExporterFactory<V, E> {
|
|||
return exporter;
|
||||
}
|
||||
|
||||
String getQuotedId(V vertex) {
|
||||
String id = vertexIdProvider.apply(vertex);
|
||||
return "\"" + id + "\"";
|
||||
}
|
||||
|
||||
private GraphExporter<V, E> createDotExporter() {
|
||||
DOTExporter<V, E> exporter = new DOTExporter<>(vertexIdProvider);
|
||||
// DOT format is picky about its identifiers, so pass in a vertex id supplier
|
||||
// that wraps the vertex ids in quotes
|
||||
DOTExporter<V, E> exporter = new DOTExporter<>(this::getQuotedId);
|
||||
setupExporter(exporter);
|
||||
return exporter;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
|
|||
|
||||
private final PluginTool pluginTool;
|
||||
private String title;
|
||||
private AttributedGraph graph;
|
||||
|
||||
/**
|
||||
* Create the initial display, the graph-less visualization viewer, and its controls
|
||||
|
@ -55,7 +56,8 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
|
|||
|
||||
@Override
|
||||
public void setGraphDisplayListener(GraphDisplayListener listener) {
|
||||
// This display is not interactive, so N/A
|
||||
// This display is not interactive, so just dispose the listener
|
||||
listener.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,10 +88,11 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setGraph(AttributedGraph graphData, String title, boolean append,
|
||||
public void setGraph(AttributedGraph graph, String title, boolean append,
|
||||
TaskMonitor monitor) {
|
||||
this.title = title;
|
||||
doSetGraphData(graphData);
|
||||
this.graph = graph;
|
||||
doSetGraphData(graph);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +135,7 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
|
|||
|
||||
@Override
|
||||
public AttributedGraph getGraph() {
|
||||
return null;
|
||||
return graph;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -276,14 +276,14 @@ public class GraphExporterDialog extends DialogComponentProvider {
|
|||
GraphExportFormat exporterFormat = getSelectedExporter();
|
||||
File outputFile = getSelectedOutputFile();
|
||||
|
||||
try {
|
||||
if (outputFile.exists() &&
|
||||
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;
|
||||
}
|
||||
Writer writer = new FileWriter(outputFile);
|
||||
}
|
||||
|
||||
try (Writer writer = new FileWriter(outputFile)) {
|
||||
|
||||
GraphExporter<AttributedVertex, AttributedEdge> exporter =
|
||||
AttributedGraphExporterFactory.getExporter(exporterFormat);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue