X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.debug.ui%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fui%2FSearchResourceDialog.java;fp=bundles%2Forg.simantics.debug.ui%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fui%2FSearchResourceDialog.java;h=2e5e8c0d3f44fa6b86db92a70774d5242e8f5f75;hb=a8ea477a16e16f53f2909c58fb88a379b36b3f2c;hp=24f7f5bd8c4aa1cd40684875e34cc9e0fb42b213;hpb=c10753c13921e63c6bb2cf51335a9c6d402efac5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java index 24f7f5bd8..2e5e8c0d3 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SearchResourceDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Association for Decentralized Information Management + * Copyright (c) 2007, 2019 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -311,8 +311,9 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { Resource project = Simantics.peekProjectResource(); if (project != null) { + Layer0 L0 = Layer0.getInstance(graph); IResourceFilter rf = resourceFilter; - String filter = getFilterForResourceFilter(rf); + String filter = getFilterForResourceFilter(L0, rf); if (!filter.isEmpty()) filter += " AND "; @@ -320,8 +321,6 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { filter += Arrays.stream(terms).map(term -> "+" + IndexQueries.escape(term.toLowerCase(), false) + "*").collect(Collectors.joining(" ")); filter +=")"; - Layer0 L0 = Layer0.getInstance(graph); - Set indexRoots = new HashSet<>(); indexRoots.addAll(graph.syncRequest(new ObjectsWithType(project, L0.ConsistsOf, L0.IndexRoot))); indexRoots.addAll(graph.syncRequest(new OntologiesFromLibrary(graph.getRootLibrary()))); @@ -472,13 +471,13 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { this.resourceFilter = resourceFilter; } - private String getFilterForResourceFilter(IResourceFilter filter) { + private String getFilterForResourceFilter(Layer0 l0, IResourceFilter filter) { if (filter == null || filter == ResourceSearch.FILTER_ALL) return ""; if (filter == ResourceSearch.FILTER_RELATIONS) - return "Types:Relation"; + return IndexQueries.resourceIdTerm(Dependencies.FIELD_TYPE_RESOURCE, l0.Relation); if (filter == ResourceSearch.FILTER_TYPES) - return "Types:Type"; + return IndexQueries.resourceIdTerm(Dependencies.FIELD_TYPE_RESOURCE, l0.Type); return ""; }