X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.debug.ui%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fui%2FSearchResourceDialog.java;h=591436dc529ec8329cd41890b1c0f3cb7e63b7d2;hp=06710f6e29bd03a3dec4ecbdc50d5f4afdbd4b64;hb=ad0e5bf4b34705988e23c9ee3f8e4fcbb760c701;hpb=0f2d6b33db9eabe0c1b142f6d0197a5d1446c3b1 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 06710f6e2..591436dc5 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 "; //$NON-NLS-1$ @@ -320,8 +321,6 @@ public class SearchResourceDialog extends FilteredItemsSelectionDialog { filter += Arrays.stream(terms).map(term -> "+" + IndexQueries.escape(term.toLowerCase(), false) + "*").collect(Collectors.joining(" ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ filter +=")"; //$NON-NLS-1$ - 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 ""; //$NON-NLS-1$ if (filter == ResourceSearch.FILTER_RELATIONS) - return "Types:Relation"; //$NON-NLS-1$ + return IndexQueries.resourceIdTerm(Dependencies.FIELD_TYPE_RESOURCE, l0.Relation); if (filter == ResourceSearch.FILTER_TYPES) - return "Types:Type"; //$NON-NLS-1$ + return IndexQueries.resourceIdTerm(Dependencies.FIELD_TYPE_RESOURCE, l0.Type); return ""; //$NON-NLS-1$ }