Layer0 l0 = Layer0.getInstance(g);\r
SysdynResource SYSDYN = SysdynResource.getInstance(g);\r
\r
- if (g.isInstanceOf(module, SYSDYN.IndependentVariable) || g.isInstanceOf(module, SYSDYN.Input)) {\r
+ if (g.isInstanceOf(module, SYSDYN.IndependentVariable) || g.isInstanceOf(module, SYSDYN.Input) || g.isInstanceOf(module, SYSDYN.Module)) {\r
Collection<Runnable> result = new ArrayList<Runnable>(1);\r
\r
Resource composite = g.getSingleObject(module, l0.PartOf);\r
import org.simantics.layer0.Layer0;\r
import org.simantics.operation.Layer0X;\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.SearchResult;\r
import org.simantics.workbench.search.Searching;\r
*/\r
public class ModulesSearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, Resource, String, Integer, Collection<SearchResult>> {\r
\r
+ private final int MAX_RESULTS = 50000;\r
+ \r
@Override\r
public Collection<SearchResult> apply(IProgressMonitor monitor, ReadGraph graph, Resource model, String query, Integer maxResults) {\r
try {\r
Collection<Map<String, Object>> results = Searching.performSearch(graph,\r
- Layer0X.getInstance(graph).Dependencies, model, query, maxResults);\r
+ Layer0X.getInstance(graph).Dependencies, model, query, MAX_RESULTS);\r
\r
return generateSearchResults(graph, results);\r
} catch (DatabaseException e) {\r
Collection<Map<String, Object>> results) throws DatabaseException {\r
Layer0 L0 = Layer0.getInstance(graph);\r
DiagramResource DIA = DiagramResource.getInstance(graph);\r
+ SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
\r
Collection<SearchResult> result = new ArrayList<SearchResult>(results.size());\r
Set<Resource> processed = new HashSet<Resource>();\r
for (Map<String, Object> r : results) {\r
Resource resource = (Resource) r.get(Dependencies.FIELD_RESOURCE);\r
\r
+ // Only Auxiliary, Stock, Valve, Input, and Module \r
+ if (!(graph.isInstanceOf(resource, SYSDYN.IndependentVariable)\r
+ || graph.isInstanceOf(resource, SYSDYN.Input)\r
+ || graph.isInstanceOf(resource, SYSDYN.Module)))\r
+ continue;\r
+\r
// Prevent index corruption from producing duplicate results.\r
if (!processed.add(resource))\r
continue;\r