]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixed Sysdyn search (refs #4786).
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 26 Mar 2014 12:45:03 +0000 (12:45 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 26 Mar 2014 12:45:03 +0000 (12:45 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29202 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/function/ModulesSearchFunction.java

index 716cc5ede4698112b3ef5eddc22baf77058de7ff..37bbc783792c29bddb184129cd537704d14ed2a2 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index 5da8119c678e9b833679faa85f05e293af2c34ff..1ad68f5d00c9ca77e2d59e2e7465d826e70adda1 100644 (file)
@@ -91,6 +91,7 @@ SYSDYN.HistoryRealization <T L0X.Realization
 SYSDYN.DefaultRealization <T L0X.Realization
 
 SYSDYN.ModulesSearchFunction : L0.Function
+  L0.HasLabel "Sysdyn Search" : L0.String
 
 SYSDYN.SearchContribution : WORKBENCH.SearchContribution
   WORKBENCH.hasSearchFunction SYSDYN.ModulesSearchFunction
index 3caae72cec844972cf5635e0347207c191133503..edf5afea8c70daaacebbb4c2845f26c57e45ebed 100644 (file)
@@ -58,10 +58,20 @@ public class ModulesSearchFunction extends FunctionImpl5<IProgressMonitor, ReadG
     @Override\r
     public SearchResult apply(IProgressMonitor monitor, ReadGraph graph, Resource model, SearchQuery query, Integer maxResults) {\r
         try {\r
+               String origQuery = query.getOriginalQuery();\r
+               if (!origQuery.isEmpty()) // Add asterisks for performSearch \r
+                       query.setOriginalQuery("*" + origQuery + "*");\r
+               \r
                // Check whether only currently open diagram is searched\r
                String filteredQuery = query.getQuery("Name","Types");\r
-               Collection<Map<String, Object>> results = Searching.performSearch(graph, Layer0X.getInstance(graph).Dependencies, model, filteredQuery, MAX_RESULTS);\r
+               Collection<Map<String, Object>> results = Searching.performSearch(graph, \r
+                               Layer0X.getInstance(graph).Dependencies, \r
+                               model, \r
+                               filteredQuery, \r
+                               MAX_RESULTS);\r
 \r
+               query.setOriginalQuery(origQuery); // Restore the original query without *'s\r
+               \r
                if (!query.getSearchParams().contains(FindSearchTrim.CURRENT_DIAGRAM_OPTION))\r
                return generateSearchResults(graph, results, Scope.ALL_MODELS);\r
                else\r