1 package org.simantics.sysdyn.ui.properties.widgets.arrays;
\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.utils.OrderedSetUtils;
\r
11 import org.simantics.db.exception.DatabaseException;
\r
12 import org.simantics.sysdyn.SysdynResource;
\r
14 public class UsedEnumerations extends ViewpointContributorImpl<Resource> {
\r
17 public Collection<?> getContribution(ReadGraph graph, Resource input)
\r
18 throws DatabaseException {
\r
19 SysdynResource sr = SysdynResource.getInstance(graph);
\r
21 ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();
\r
23 Resource arrayIndexes = graph.getPossibleObject(input, sr.HasArrayIndexes);
\r
24 if(arrayIndexes == null) {
\r
27 for(Resource r : OrderedSetUtils.toList(graph, arrayIndexes)) {
\r
28 result.add(new EnumerationNode(r));
\r
34 public String getViewpointId() {
\r
35 return "Available enumerations";
\r