1 package org.simantics.sysdyn.ui.browser.contributions;
\r
3 import java.util.ArrayList;
\r
4 import java.util.Collection;
\r
6 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;
\r
7 import org.simantics.db.ReadGraph;
\r
8 import org.simantics.db.Resource;
\r
9 import org.simantics.db.common.request.ObjectsWithType;
\r
10 import org.simantics.db.exception.DatabaseException;
\r
11 import org.simantics.layer0.Layer0;
\r
12 import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode;
\r
13 import org.simantics.sysdyn.SysdynResource;
\r
15 public class SysdynProject extends ViewpointContributor<Resource> {
\r
18 public Collection<?> getContribution(ReadGraph graph, Resource project)
\r
19 throws DatabaseException {
\r
21 ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();
\r
22 Layer0 L0 = Layer0.getInstance(graph);
\r
23 for(Resource r : graph.syncRequest(new ObjectsWithType(project, L0.ConsistsOf, SysdynResource.getInstance(graph).SysdynModel))) {
\r
25 result.add(graph.adapt(r, AbstractNode.class));
\r
26 } catch(DatabaseException e) {
\r
27 e.printStackTrace();
\r
35 public String getViewpointId() {
\r