Switch to unified view

a/tool/src/main/actions.java b/tool/src/main/actions.java
...
...
23
import java.io.IOException;
23
import java.io.IOException;
24
import java.util.ArrayList;
24
import java.util.ArrayList;
25
import java.util.logging.Level;
25
import java.util.logging.Level;
26
import java.util.logging.Logger;
26
import java.util.logging.Logger;
27
import javax.swing.JTree;
27
import javax.swing.JTree;
28
import javax.swing.tree.DefaultMutableTreeNode;
29
import javax.swing.tree.TreePath;
28
import script.log;
30
import script.log;
29
import spdxlib.SPDXfile;
31
import spdxlib.SPDXfile;
30
32
31
33
32
public class actions {
34
public class actions {
...
...
112
        softwareNode.setIcon("box-label.png");
114
        softwareNode.setIcon("box-label.png");
113
        
115
        
114
        // create a tree based on folder tree on disk
116
        // create a tree based on folder tree on disk
115
        findFolders(core.getProductsFolder(), 25, softwareNode);
117
        findFolders(core.getProductsFolder(), 25, softwareNode);
116
        
118
        
119
        
120
        // we use this value for later showing the products (SPDX) node
121
        // fully expanded
122
        core.temp.put(is.products, softwareNode.getUID());
123
        
124
       // swingUtils.setSelectedNode(softwareNode.getUID());
117
    }
125
    }
118
    
126
    
119
    /**
127
    /**
120
     * Find all subfolders in a given folder.
128
     * Find all subfolders in a given folder.
121
     * @param where A file object of the start folder
129
     * @param where A file object of the start folder
...
...
196
        //  how many files were found here?
204
        //  how many files were found here?
197
        rootNode.setCounter(count);
205
        rootNode.setCounter(count);
198
        return count;
206
        return count;
199
      }
207
      }
200
    
208
    
201
//     /**
202
//     * This is a critical method. It will look for all SPDX files inside a given
203
//     * folder and them as tree nodes
204
//     * @param tree 
205
//     */
206
//    public static void addTreeSPDXOld(JTree tree) {
207
//        // only find the SPDX documents with .SPDX extension
208
//        ArrayList<File> initialFileList = utils.files
209
//                .findFilesFiltered(core.getProductsFolder(), ".spdx", 25);
210
//        
211
//        if(initialFileList.isEmpty()){
212
//            // no need to continue, just leave here
213
//            return;
214
//        }
215
//        
216
//        // this is used for filtering duplicate folders in the initial indexing
217
//        ArrayList<File> tempFolderList = new ArrayList();
218
//        // where are our spdx files stored?
219
//        String baseFolder = core.getProductsFolder().getAbsolutePath();
220
//        // get the root node where we have our treeview
221
//        TreeNodeSPDX rootNode = swingUtils.getRootNode(tree);
222
//        
223
//        // where we place all results after being filtered
224
//        ArrayList<File> fileList = new ArrayList();
225
//        // iterate all files in our array that were found as products
226
//        for(File file: initialFileList){
227
//            // now we need to filter what we don't want to have in our array
228
//            String filename = file.getName();
229
//            // we don't need SVN files, ignore them completely
230
//            if(filename.endsWith(".svn-base")){
231
//                continue;
232
//            }
233
//            // add this file to our final list
234
//            fileList.add(file);
235
//            // now take care of the folder where this file was placed
236
//            // get only the folder base, be careful with path separators here
237
//            String folderName = file.getParent().replace(baseFolder, "");
238
//            // no need to add in case the folder is the root
239
//            if(folderName.isEmpty()){
240
//                continue;
241
//            }
242
//            File folder = file.getParentFile();
243
//            // no need to continue in case this folder was already added before
244
//            if(tempFolderList.contains(folder)){
245
//                continue;
246
//            }
247
//            // add it up
248
//            tempFolderList.add(folder);
249
//        }
250
//        
251
//         // create the node for hosting our list of SPDX documents
252
//        TreeNodeSPDX softwareNode = nodeCreate(
253
//                "Software (" + fileList.size() + ")"
254
//                , NodeType.other, rootNode);
255
//        // add the identification to this tag
256
//        softwareNode.id = "Software";
257
//        softwareNode.setIcon("box.png");
258
//        
259
//        // we need to map a list of spdx folders and files
260
//        HashMap<File, TreeNodeSPDX> folderList = new HashMap();
261
//        // first pass to add up all nodes and folders
262
//        for(File folder : tempFolderList){
263
//            TreeNodeSPDX node = new TreeNodeSPDX(folder.getName());
264
//            node.setIcon("envelope.png");
265
//            folderList.put(folder, node);
266
//        }
267
//       
268
//        
269
//        
270
//        // second pass to add them all up on the tree view
271
//        for(File folder : folderList.keySet()){
272
//            TreeNodeSPDX node = folderList.get(folder);
273
//            softwareNode.add(node);
274
//        }
275
//        
276
//                
277
//      
278
//        //System.exit(-1981);
279
//    }  
280
//        
281
       
282
//        
283
//        // iterate through the final list, build the folder list, add tree nodes
284
//        for(File file: fileList){
285
//            // get only the folder base, be careful with path separators here
286
//            String folderName = file.getParent().replace(baseFolder, "");
287
//            // no need to add in case the folder is the root
288
//            if(folderName.isEmpty()){
289
//                continue;
290
//            }
291
//            // no need to continue in case this folder was already added before
292
//            if(folderList.containsKey(folderName)){
293
//                continue;
294
//            }
295
//            
296
//            String simpleFolderName = file.getParentFile().getName();
297
//            
298
//            // create the node for hosting our list of SPDX documents
299
//            TreeNodeSPDX node = nodeCreate(
300
//                    simpleFolderName // get the normal name (no path components)
301
//                    , NodeType.folder // just a normal folder
302
//                    , rootNode); // add 
303
//        // add the identification to this tag
304
//        softwareNode.id = "";
305
//            
306
//            // build up our list of folders
307
//            System.err.println(folderName);
308
//            folderList.put(folderName, rootNode);
309
//        }             
310
            
311
  
312
    
209
    
313
}
210
}