--- a/tool/run/plugins/basic/TreeNodeDetails.java
+++ b/tool/run/plugins/basic/TreeNodeDetails.java
@@ -22,6 +22,7 @@
import java.awt.Cursor;
import java.io.File;
import java.util.Enumeration;
+import java.util.HashMap;
import main.core;
import main.param;
import script.Plugin;
@@ -146,22 +147,33 @@
* @param spdx
*/
private void doTreeStructure(TreeNodeSPDX root, SPDXfile spdx){
+
+ HashMap nodeList = new HashMap();
+
// go through all the files inside the SPDX
for(FileInfo fileInfo : spdx.fileSection.files){
// get the path for this file bit
String path = getFilePath(fileInfo);
//String parentFolder = getParentFolder(path);
// add it up to our list
- TreeNodeSPDX pathNode = addNodeFolder(root, path);
- }
-
-
+ TreeNodeSPDX folderNode = addNodeFolder(root, path);
+ // put in our cached list
+ path = path.substring(0, path.length() -1);
+ nodeList.put(path, folderNode);
+ // ./jfreechart-1.0.17/lib/
+ //System.err.println(path);
+ }
+
+ // now add only the files
for(FileInfo fileInfo : spdx.fileSection.files){
// get the path for this file bit
String path = getFilePath(fileInfo);
- //String parentFolder = getParentFolder(path);
- // add it up to our list
- TreeNodeSPDX pathNode = addNodeFolder(root, path);
+
+ // get the cached location of its parent node
+ String parentFolder = getParentFolder(path);
+ // ./jfreechart-1.0.17/lib
+ TreeNodeSPDX pathNode = (TreeNodeSPDX) nodeList.get(parentFolder);
+
TreeNodeSPDX nodeFile = new TreeNodeSPDX(fileInfo.toString());
nodeFile.id = fileInfo.getName();
@@ -173,21 +185,7 @@
}
-
-//
-// /**
-// * Provides a pretty name to place on the tree view
-// * @param fileInfo
-// * @return
-// */
-// private String getSimpleName(FileInfo fileInfo){
-// String result = fileInfo.tagFileName.getValue();
-// if(result.contains("/")){
-// return result.substring(result.lastIndexOf("/")+1);
-// }
-// return result;
-// }
-
+
/**
* Adds a given folder as child from a specific folder
@@ -292,21 +290,21 @@
}
-// /**
-// * Returns the parent path (if available)
-// */
-// private String getParentFolder(String path){
-// // we need to count the number of slashes
-// int lengthOriginal = path.length();
-// String temp = path.replace("/", "");
-// // do we have at least two slashes?
-// if(lengthOriginal > (temp.length() + 1)){
-// // get everything up to last slash
-// return path.substring(0, path.lastIndexOf("/"));
-// }
-// // we have nothing, return the root folder
-// return "./";
-// }
+ /**
+ * Returns the parent path (if available)
+ */
+ private String getParentFolder(String path){
+ // we need to count the number of slashes
+ int lengthOriginal = path.length();
+ String temp = path.replace("/", "");
+ // do we have at least two slashes?
+ if(lengthOriginal > (temp.length() + 1)){
+ // get everything up to last slash
+ return path.substring(0, path.lastIndexOf("/"));
+ }
+ // we have nothing, return the root folder
+ return "./";
+ }
/**