]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
f234424788d45833d49f4c7ce563b5757297e96e
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.wizards.functions;\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.sysdyn.SysdynResource;\r
13 import org.simantics.sysdyn.ui.browser.nodes.FunctionLibraryNode;\r
14 import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
15 \r
16 public class FunctionTreeLibraries extends ViewpointContributor<ModelNode> {\r
17 \r
18     @Override\r
19     public Collection<?> getContribution(ReadGraph graph, ModelNode model)\r
20     throws DatabaseException {\r
21         ArrayList<FunctionLibraryNode<Resource>> result = new ArrayList<FunctionLibraryNode<Resource>>();\r
22                 Layer0 l0 = Layer0.getInstance(graph);\r
23                 SysdynResource sr = SysdynResource.getInstance(graph);\r
24         \r
25                 for (Resource r : graph.syncRequest(new ObjectsWithType(model.data, l0.ConsistsOf, sr.SysdynModelicaFunctionLibrary))){\r
26                         result.add(new FunctionLibraryNode<Resource>(r));\r
27                 }\r
28 \r
29         return result;\r
30     }\r
31 \r
32     @Override\r
33     public String getViewpointId() {\r
34         return "Standard";\r
35     }\r
36 \r
37 }\r