mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-280 fixed issue preventing exporting a graph to DOT format.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user