-/*******************************************************************************\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.image.ui.modelBrowser;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.browsing.ui.common.node.AbstractNode;\r
-import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ObjectsWithType;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.request.Read;\r
-import org.simantics.image2.ontology.ImageResource;\r
-import org.simantics.layer0.Layer0;\r
-\r
-public class Image extends ViewpointContributor<ImagesNode> {\r
-\r
- @Override\r
- public final Collection<?> getContribution(ReadGraph graph, ImagesNode lib) throws DatabaseException {\r
- ArrayList<AbstractNode<?>> result = new ArrayList<AbstractNode<?>>();\r
- Read<Collection<Resource>> read = getChildRequest(graph, lib);\r
- if (read != null) {\r
- for (Resource r : graph.syncRequest(read)) {\r
- try {\r
- AbstractNode<?> n = graph.adapt(r, AbstractNode.class);\r
- result.add(n);\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- }\r
- return result;\r
- }\r
-\r
- @Override\r
- public String getViewpointId() {\r
- return "Standard";\r
- }\r
-\r
- protected Read<Collection<Resource>> getChildRequest(ReadGraph graph, ImagesNode lib) throws DatabaseException {\r
- Layer0 L0 = Layer0.getInstance(graph);\r
- ImageResource IMG = ImageResource.getInstance(graph);\r
- return new ObjectsWithType(lib.data, L0.ConsistsOf, IMG.Image);\r
- }\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.image.ui.modelBrowser;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.simantics.browsing.ui.common.node.AbstractNode;
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ObjectsWithType;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.request.Read;
+import org.simantics.image2.ontology.ImageResource;
+import org.simantics.layer0.Layer0;
+
+public class Image extends ViewpointContributor<ImagesNode> {
+
+ @Override
+ public final Collection<?> getContribution(ReadGraph graph, ImagesNode lib) throws DatabaseException {
+ ArrayList<AbstractNode<?>> result = new ArrayList<AbstractNode<?>>();
+ Read<Collection<Resource>> read = getChildRequest(graph, lib);
+ if (read != null) {
+ for (Resource r : graph.syncRequest(read)) {
+ try {
+ AbstractNode<?> n = graph.adapt(r, AbstractNode.class);
+ result.add(n);
+ } catch (DatabaseException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public String getViewpointId() {
+ return "Standard";
+ }
+
+ protected Read<Collection<Resource>> getChildRequest(ReadGraph graph, ImagesNode lib) throws DatabaseException {
+ Layer0 L0 = Layer0.getInstance(graph);
+ ImageResource IMG = ImageResource.getInstance(graph);
+ return new ObjectsWithType(lib.data, L0.ConsistsOf, IMG.Image);
+ }
+
+}