]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixed workbench search to work better with multiple active models, as in Sysdyn.
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 5 Jul 2013 13:01:40 +0000 (13:01 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 5 Jul 2013 13:01:40 +0000 (13:01 +0000)
refs #3966

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27696 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/function/ModulesSearchFunction.java

index ba8f42a177e447d9c2bedf124721852b8a324332..68d716c5ea277301c2e304414757b8cce7c46353 100644 (file)
@@ -11,7 +11,6 @@
  *******************************************************************************/\r
 package org.simantics.sysdyn.ui.function;\r
 \r
-import java.io.IOException;\r
 import java.util.ArrayList;\r
 import java.util.Collection;\r
 import java.util.HashSet;\r
@@ -29,20 +28,14 @@ import org.simantics.db.layer0.genericrelation.Dependencies;
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.operation.Layer0X;\r
-import org.simantics.scl.runtime.function.FunctionImpl4;\r
 import org.simantics.scl.runtime.function.FunctionImpl5;\r
-import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.workbench.search.NamedResource;\r
-import org.simantics.workbench.search.QueryResult;\r
 import org.simantics.workbench.search.SearchResult;\r
 import org.simantics.workbench.search.Searching;\r
 \r
-//import fi.vtt.apros.AprosBuiltins;\r
-import freemarker.template.TemplateException;\r
-\r
 /**\r
  * modulesSearchFunction:\r
- *      (ReadGraph, query : String, maxResults : Integer) -> QueryResult\r
+ *      (IProgressMonitor, ReadGraph, model : Resource, query : String, maxResults : Integer) -> QueryResult\r
  * \r
  * @author Tuukka Lehtonen\r
  */\r
@@ -63,9 +56,7 @@ public class ModulesSearchFunction extends FunctionImpl5<IProgressMonitor, ReadG
 \r
     public static final Collection<SearchResult> generateSearchResults(ReadGraph graph,\r
             Collection<Map<String, Object>> results) throws DatabaseException {\r
-       System.out.println(results.size());\r
-       Layer0 L0 = Layer0.getInstance(graph);\r
-       SysdynResource SR = SysdynResource.getInstance(graph);\r
+        Layer0 L0 = Layer0.getInstance(graph);\r
         DiagramResource DIA = DiagramResource.getInstance(graph);\r
 \r
         Collection<SearchResult> result = new ArrayList<SearchResult>(results.size());\r
@@ -74,14 +65,6 @@ public class ModulesSearchFunction extends FunctionImpl5<IProgressMonitor, ReadG
         for (Map<String, Object> r : results) {\r
             Resource resource = (Resource) r.get(Dependencies.FIELD_RESOURCE);\r
 \r
-            // Ignore non-AprosModules\r
-            /*if (!graph.isInstanceOf(resource, APROS.AprosModule))\r
-                continue;\r
-\r
-            // Ignore attached default modules.\r
-            if (graph.hasStatement(resource, APROS.AttachedModule))\r
-                continue;*/\r
-\r
             // Prevent index corruption from producing duplicate results.\r
             if (!processed.add(resource))\r
                 continue;\r