From 2f447ae0d0d9812b858101013f3f1e318da6bfef Mon Sep 17 00:00:00 2001 From: Tom Nelson Date: Tue, 25 Aug 2020 15:21:57 +0000 Subject: [PATCH] added javadoc and updated jungrapht versions to 1.0-RC9 fixed vertex naming to create labels if no label at address. removed local vertex renaming vertex-only selection enabled and grow selection made yellow edges darker fix initial layout scaling for subgraph display address warnings and increase stroke size for vertices comments and adjusting initial layout area size calculation multiselection strategy moved buttons out of function so they can be re-enabled in popup menu cleaned up and documented selection menus improve selection following by sending only one event, filtering hidden elements, and disabliing the butten when selection is complete improve grow selection to grow from all selected vertices better generics, simplified root predicate. added flag so multiaction does not have to fire an action on the first item support renaming from the graph view added rename popup. corrected some errors use function to control mincross work based on graph size fixed LayoutWorkingDialog close issue a better way. use toggle button for magnifier and connect with Lens kill switch html escape the attributes in case they include things like < and > changed thread stop and added initial dimension function --- .gitignore | 13 + .../AddressBasedGraphDisplayListener.java | 18 + Ghidra/Features/GraphServices/Module.manifest | 8 +- Ghidra/Features/GraphServices/build.gradle | 10 +- .../GraphServices/certification.manifest | 1 + .../topics/GraphServices/GraphDisplay.htm | 33 +- .../AttributedGraphExporterFactory.java | 4 +- .../export/ExportAttributedGraphDisplay.java | 2 +- .../ExportAttributedGraphDisplayProvider.java | 3 +- .../graph/export/GraphExportFormat.java | 2 +- .../graph/export/GraphExporterDialog.java | 2 +- .../graph/visualization/CenterAnimation.java | 12 +- .../ghidra/graph/visualization/Colors.java | 7 +- .../DefaultDisplayGraphIcons.java | 3 +- .../visualization/DefaultGraphDisplay.java | 555 +++++++++++++----- .../DefaultGraphDisplayComponentProvider.java | 2 +- .../DefaultGraphDisplayProvider.java | 2 +- .../graph/visualization/EdgeComparator.java | 2 +- .../graph/visualization/FilterDialog.java | 2 +- .../graph/visualization/GhidraGraphMouse.java | 158 +++++ .../graph/visualization/GhidraIconCache.java | 52 +- .../graph/visualization/LayoutFunction.java | 89 +-- .../LayoutTransitionManager.java | 193 +++--- .../visualization/LayoutWorkingDialog.java | 57 ++ .../visualization/OnEdgeSelectionMenu.java | 68 +++ .../visualization/OnVertexSelectionMenu.java | 68 +++ .../visualization/ProgramGraphFunctions.java | 3 +- .../visualization/SelectionFilterMenu.java | 228 +++++++ .../src/main/resources/images/Lasso.png | Bin 0 -> 364 bytes .../src/main/resources/jungrapht.properties | 18 +- .../builder/MultiStateActionBuilder.java | 13 + .../docking/menu/MultiStateDockingAction.java | 27 +- .../src/main/resources/generic.log4jdev.xml | 4 +- .../service/graph/AttributedVertex.java | 8 +- .../service/graph/GraphDisplayListener.java | 5 + 35 files changed, 1317 insertions(+), 355 deletions(-) create mode 100644 Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/GhidraGraphMouse.java create mode 100644 Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutWorkingDialog.java create mode 100644 Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/OnEdgeSelectionMenu.java create mode 100644 Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/OnVertexSelectionMenu.java create mode 100644 Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/SelectionFilterMenu.java create mode 100644 Ghidra/Features/GraphServices/src/main/resources/images/Lasso.png diff --git a/.gitignore b/.gitignore index 142454039a..6cad771b5c 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,16 @@ Release */*/*/*/src-gen */*/*/*/model/generated */*/*/*/test-bin + +# Ignore Intellij metadata +**/*.iml +**/.idea +*.iml +.idea + +# Ignore gradle wrapper files +gradle/wrapper +gradlew +gradlew.* + + diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java index a016010465..82761e641a 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java @@ -19,7 +19,10 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; +import ghidra.app.cmd.label.AddLabelCmd; +import ghidra.app.cmd.label.RenameLabelCmd; import ghidra.app.events.*; +import ghidra.framework.cmd.Command; import ghidra.framework.model.*; import ghidra.framework.plugintool.PluginEvent; import ghidra.framework.plugintool.PluginTool; @@ -161,6 +164,21 @@ public abstract class AddressBasedGraphDisplayListener return p == program; } + @Override + public boolean updateVertexName(String vertexId, String oldName, String newName) { + Address address = getAddressForVertexId(vertexId); + Symbol symbol = program.getSymbolTable().getPrimarySymbol(address); + + Command command; + if (symbol != null) { + command = new RenameLabelCmd(address, oldName, newName, SourceType.USER_DEFINED); + } + else { + command = new AddLabelCmd(address, newName, SourceType.USER_DEFINED); + } + return tool.execute(command, program); + } + @Override public void domainObjectChanged(DomainObjectChangedEvent ev) { if (!(ev.containsEvent(ChangeManager.DOCR_SYMBOL_ADDED) || diff --git a/Ghidra/Features/GraphServices/Module.manifest b/Ghidra/Features/GraphServices/Module.manifest index 2601f0c525..d9640d0931 100644 --- a/Ghidra/Features/GraphServices/Module.manifest +++ b/Ghidra/Features/GraphServices/Module.manifest @@ -1,7 +1,9 @@ EXCLUDE FROM GHIDRA JAR: true -MODULE FILE LICENSE: lib/jungrapht-visualization-1.0-RC8.jar BSD -MODULE FILE LICENSE: lib/jgrapht-core-1.4.0.jar LGPL 2.1 -MODULE FILE LICENSE: lib/jgrapht-io-1.4.0.jar LGPL 2.1 +MODULE FILE LICENSE: lib/jungrapht-visualization-1.0-SNAPSHOT.jar BSD +MODULE FILE LICENSE: lib/jgrapht-core-1.5.0.jar LGPL 2.1 +MODULE FILE LICENSE: lib/jgrapht-io-1.5.0.jar LGPL 2.1 MODULE FILE LICENSE: lib/jheaps-0.11.jar Apache License 2.0 +MODULE FILE LICENSE: lib/log4j-slf4j-impl-2.12.1.jar Apache License 2.0 MODULE FILE LICENSE: lib/slf4j-api-1.7.25.jar MIT +MODULE FILE LICENSE: lib/slf4j-nop-1.7.25.jar MIT diff --git a/Ghidra/Features/GraphServices/build.gradle b/Ghidra/Features/GraphServices/build.gradle index 55ce5ae4f0..34d2ed640c 100644 --- a/Ghidra/Features/GraphServices/build.gradle +++ b/Ghidra/Features/GraphServices/build.gradle @@ -11,13 +11,17 @@ eclipse.project.name = 'Features Graph Services' dependencies { compile project(":Base") - compile "com.github.tomnelson:jungrapht-visualization:1.0-RC8" - compile "org.jgrapht:jgrapht-core:1.4.0" + compile "com.github.tomnelson:jungrapht-visualization:1.0-RC9" + compile "com.github.tomnelson:jungrapht-layout:1.0-RC9" + compile "org.jgrapht:jgrapht-core:1.5.0" // not using jgrapht-io code that depends on antlr, so exclude antlr - compile ("org.jgrapht:jgrapht-io:1.4.0") { exclude group: "org.antlr", module: "antlr4-runtime" } + compile ("org.jgrapht:jgrapht-io:1.5.0") { exclude group: "org.antlr", module: "antlr4-runtime" } runtime "org.slf4j:slf4j-api:1.7.25" + // use this if you want no slf4j log messages runtime "org.slf4j:slf4j-nop:1.7.25" + // use this if you want slf4j log messages sent to log4j +// runtime "org.apache.logging.log4j:log4j-slf4j-impl:2.12.1" runtime "org.jheaps:jheaps:0.11" helpPath project(path: ":Base", configuration: 'helpPath') diff --git a/Ghidra/Features/GraphServices/certification.manifest b/Ghidra/Features/GraphServices/certification.manifest index 2942238218..96cfda73b6 100644 --- a/Ghidra/Features/GraphServices/certification.manifest +++ b/Ghidra/Features/GraphServices/certification.manifest @@ -15,6 +15,7 @@ src/main/help/help/topics/GraphServices/GraphDisplay.htm||GHIDRA||||END| src/main/help/help/topics/GraphServices/GraphExport.htm||GHIDRA||||END| src/main/help/help/topics/GraphServices/images/DefaultGraphDisplay.png||GHIDRA||||END| src/main/help/help/topics/GraphServices/images/ExportDialog.png||GHIDRA||||END| +src/main/resources/images/Lasso.png||GHIDRA||||END| src/main/resources/images/magnifier.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END| src/main/resources/images/redspheregraph.png||GHIDRA||||END| src/main/resources/images/sat2.png||GHIDRA||||END| diff --git a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm index fc902b4cbe..8bc74f3830 100644 --- a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm +++ b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm @@ -27,6 +27,8 @@