]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
76f76f854256d8985899d93375b9a5f36f72bf5f
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.wizards.modules;\r
2 \r
3 import java.util.ArrayList;\r
4 import java.util.Collection;\r
5 \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
14 \r
15 public class ModuleTreeModules extends ViewpointContributor<ModelNode> {\r
16 \r
17     @Override\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
25                 }\r
26 \r
27         return result;\r
28     }\r
29 \r
30     @Override\r
31     public String getViewpointId() {\r
32         return "Standard";\r
33     }\r
34 \r
35 }\r