public Collection<SearchResult> apply(IProgressMonitor monitor, ReadGraph graph, Resource model, SearchQuery query, Integer maxResults) {\r
try {\r
// Check whether only currently open diagram is searched\r
- String filteredQuery = query.getQuery().replace(FindSearchTrim.CURRENT_DIAGRAM_OPTION, "");\r
- Collection<Map<String, Object>> results = Searching.performSearch(graph,\r
- Layer0X.getInstance(graph).Dependencies, model, filteredQuery, MAX_RESULTS);\r
+ String filteredQuery = query.getQuery();\r
+ Collection<Map<String, Object>> results = Searching.performSearch(graph, Layer0X.getInstance(graph).Dependencies, model, filteredQuery, MAX_RESULTS);\r
\r
- if (filteredQuery.equals(query))\r
+ if (!query.getSearchParams().contains(FindSearchTrim.CURRENT_DIAGRAM_OPTION))\r
return generateSearchResults(graph, results, Scope.ALL_MODELS);\r
else\r
return generateSearchResults(graph, results, Scope.CURRENT_DIAGRAM);\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.Composite;\r
import org.simantics.workbench.internal.contributions.search.SearchTrim;\r
+import org.simantics.workbench.search.SearchQuery;\r
\r
public class FindSearchTrim extends SearchTrim {\r
\r
if (query.trim().isEmpty())\r
return;\r
\r
- query = filter(query);\r
- query = "Name:" + query + " OR Types:" + query;\r
+// query = filter(query);\r
+// query = "Name:" + query + " OR Types:" + query;\r
\r
// Add option for showing only findings in currently open diagram\r
+// if (scope == Scope.CURRENT_DIAGRAM)\r
+// query += " " + CURRENT_DIAGRAM_OPTION;\r
+// SearchQuery searchQuery = new SearchQuery(originalQuery,query);\r
+ SearchQuery searchQuery = new SearchQuery(originalQuery);\r
+ searchQuery.setSearchFlag("Name", "on");\r
+ searchQuery.setSearchFlag("Types", "on");\r
if (scope == Scope.CURRENT_DIAGRAM)\r
- query += " " + CURRENT_DIAGRAM_OPTION;\r
- performQuery(originalQuery, query, ResultBrowser.VIEW);\r
+ searchQuery.setSearchParam(CURRENT_DIAGRAM_OPTION);\r
+ performQuery(searchQuery, ResultBrowser.VIEW);\r
\r
} \r
\r