1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.workbench.search;
14 import java.util.Collection;
17 import org.eclipse.core.runtime.IProgressMonitor;
18 import org.simantics.db.ReadGraph;
19 import org.simantics.db.Resource;
20 import org.simantics.db.common.utils.Logger;
21 import org.simantics.db.exception.DatabaseException;
22 import org.simantics.operation.Layer0X;
23 import org.simantics.scl.runtime.function.FunctionImpl5;
26 * dependenciesSearchFunction:
27 * (IProgressMonitor, ReadGraph, model : Resource, query : String, maxResults : Integer) -> QueryResult
29 * @author Tuukka Lehtonen
31 public class DependenciesSearchFunction extends FunctionImpl5<IProgressMonitor, ReadGraph, Resource, SearchQuery, Integer, SearchResult> {
34 public SearchResult apply(IProgressMonitor monitor, ReadGraph graph, Resource model, SearchQuery query, Integer maxResults) {
36 Collection<Map<String, Object>> results = Searching.performSearch(graph,
37 Layer0X.getInstance(graph).Dependencies, model, query.getQuery("Name","Types"), maxResults);
39 return Searching.generateDependenciesSearchResult(graph, results);
40 } catch (DatabaseException e) {
41 Logger.defaultLogError(e);