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.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.stubs.StructuralResource2;
\r
13 import org.simantics.sysdyn.ui.browser.nodes.ModelNode;
\r
15 public class ModuleTreeModules extends ViewpointContributor<ModelNode> {
\r
18 public Collection<?> getContribution(ReadGraph graph, ModelNode model)
\r
19 throws DatabaseException {
\r
20 ArrayList<ModuleComponentTypeNode> result = new ArrayList<ModuleComponentTypeNode>();
\r
21 Layer0 l0 = Layer0.getInstance(graph);
\r
22 StructuralResource2 sr2 = StructuralResource2.getInstance(graph);
\r
23 for (Resource r : graph.syncRequest(new ObjectsWithType(model.data, l0.ConsistsOf, sr2.ComponentType))){
\r
24 result.add(new ModuleComponentTypeNode(r));
\r
31 public String getViewpointId() {
\r