-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.modeling.ui.modelBrowser2.contributions;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Map;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.Queries;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class DependenciesViewContributor implements RelationViewContributor {\r
-\r
- public Collection<?> getContribution(ReadGraph graph, Collection<Map<String, Object>> indexedResults) throws DatabaseException {\r
- ArrayList<Object> result = new ArrayList<Object>();\r
-\r
- for(Map<String, Object> entry : indexedResults) {\r
- Object resource = entry.get("Resource");\r
- if (resource != null) {\r
- AbstractNode node = graph.syncRequest(Queries.adapt((Resource) resource, AbstractNode.class, true));\r
- if (node != null) {\r
- result.add(node);\r
- } else {\r
- result.add(resource);\r
- }\r
- } else {\r
- Object name = entry.get("Name");\r
- if (name != null) {\r
- result.add(name);\r
- } else {\r
- StringBuilder b = new StringBuilder();\r
- for (Map.Entry<String, Object> e : entry.entrySet()) {\r
- b.append(e.getValue().toString());\r
- }\r
- result.add(b.toString());\r
- }\r
- }\r
- }\r
-\r
- return result;\r
- }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.ui.modelBrowser2.contributions;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.Queries;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class DependenciesViewContributor implements RelationViewContributor {
+
+ public Collection<?> getContribution(ReadGraph graph, Collection<Map<String, Object>> indexedResults) throws DatabaseException {
+ ArrayList<Object> result = new ArrayList<Object>();
+
+ for(Map<String, Object> entry : indexedResults) {
+ Object resource = entry.get("Resource");
+ if (resource != null) {
+ AbstractNode node = graph.syncRequest(Queries.adapt((Resource) resource, AbstractNode.class, true));
+ if (node != null) {
+ result.add(node);
+ } else {
+ result.add(resource);
+ }
+ } else {
+ Object name = entry.get("Name");
+ if (name != null) {
+ result.add(name);
+ } else {
+ StringBuilder b = new StringBuilder();
+ for (Map.Entry<String, Object> e : entry.entrySet()) {
+ b.append(e.getValue().toString());
+ }
+ result.add(b.toString());
+ }
+ }
+ }
+
+ return result;
+ }
+}