1 package org.simantics.sysdyn.ui.wizards.modules;
\r
3 import java.util.ArrayList;
\r
4 import java.util.Collection;
\r
6 import org.simantics.browsing.ui.common.node.AbstractNode;
\r
7 import org.simantics.browsing.ui.graph.impl.contributor.viewpoint.ViewpointContributorImpl;
\r
8 import org.simantics.db.ReadGraph;
\r
9 import org.simantics.db.Resource;
\r
10 import org.simantics.db.common.request.ObjectsWithType;
\r
11 import org.simantics.db.exception.DatabaseException;
\r
12 import org.simantics.layer0.Layer0;
\r
13 import org.simantics.sysdyn.SysdynResource;
\r
14 import org.simantics.sysdyn.ui.browser.nodes.ModelNode;
\r
16 public class ModuleTreeModels extends ViewpointContributorImpl<Resource> {
\r
19 public Collection<?> getContribution(ReadGraph graph, Resource input)
\r
20 throws DatabaseException {
\r
23 SysdynResource sr = SysdynResource.getInstance(graph);
\r
24 Layer0 l0 = Layer0.getInstance(graph);
\r
25 ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();
\r
26 for(Resource r : graph.syncRequest(new ObjectsWithType(input, l0.ConsistsOf, sr.SysdynModel))) {
\r
27 result.add(new ModelNode(r));
\r
34 public String getViewpointId() {
\r
35 return "Module Import";
\r