Switch to side-by-side view

--- a/tool/run/plugins/basic/pluginSearch.java
+++ b/tool/run/plugins/basic/pluginSearch.java
@@ -14,9 +14,12 @@
 package basic;
 
 import definitions.Messages;
+import definitions.definition;
 import definitions.is;
 import java.io.File;
 import java.util.ArrayList;
+import java.util.HashMap;
+import main.controller;
 import script.Plugin;
 import script.log;
 import spdxlib.FileInfo;
@@ -25,6 +28,8 @@
 import ssdeep.ssdeep;
 import main.core;
 import utils.html;
+import www.RequestOrigin;
+import www.WebRequest;
 
 
 /**
@@ -51,10 +56,41 @@
         
         // whenever a search happens, trigger this method
         log.hooks.addAction("Search: %1",
-               thisFile, "launchNewSearch");        
+               thisFile, "launchNewSearch");
+        
+        // prepare a smart feature that we love!
+        prepareFileLauncher();
+        
     }
     
    
+    /**
+     * We use the search bar to launch our internal pages. Might seem hard
+     * to understand what is the fuzz but we love to type something like
+     * "server" and see it in front of us right away.
+     */
+    private void prepareFileLauncher(){
+        // get all the java files that we are ready to launch if needed
+        ArrayList<File> files = utils.files.findFilesFiltered(core.getPluginsFolder(), 
+                ".java", 25);
+        
+        // we need some filtering
+        HashMap list = new HashMap();
+        // go through all the files we found
+        for(File file : files){
+            String name = file.getName();
+            // avoid cases like .java.old
+            if(name.endsWith(".java")){
+                // remove the .java portion, transform to lower case
+                name = name.replace(".java", "").toLowerCase();
+                // put it on our list, if duplicate just overwrite we don't care
+                list.put(name, file);
+            }
+        }
+        
+        // place the list available for the future
+        core.temp.put(definition.searchList, list);
+    }
     
     /**
      * Reacts to the case when users press the ENTER key
@@ -373,6 +409,34 @@
             //System.out.println(output);
             return true;
         }
+        // check for internal pages we can run
+        HashMap list = 
+                (HashMap) core.temp.get(definition.searchList);
+
+        // no need to continue if empty
+        if(list == null){
+            return false;
+        }
+        
+        // files matching this search? let's process
+        if(list.containsKey(searchTerm)){
+            File file = (File) list.get(searchTerm);
+            System.err.println("Matched " + searchTerm);
+            // an action happened and needs a reply
+            WebRequest request = new WebRequest();
+            // signal that this request is coming from the user interface
+            request.requestOrigin = RequestOrigin.GUI;
+            request.BaseFolder = file.getParentFile();
+            request.scriptFile = file;
+            request.scriptMethod = is.methodDefault;
+            // submit the request to be executed
+            controller.process(request);
+            // all done, hope for the best.. :-)
+            return true;
+        }
+        
+        
+        
         return false;
     }