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 EnumerationIndexes extends ViewpointContributorImpl<Resource> {
\r
17 public Collection<?> getContribution(ReadGraph graph, Resource input)
\r
18 throws DatabaseException {
\r
21 SysdynResource sr = SysdynResource.getInstance(graph);
\r
22 if(!graph.isInstanceOf(input, sr.Enumeration))
\r
24 Resource enumerationIndexList = graph.getPossibleObject(input, sr.Enumeration_enumerationIndexes);
\r
25 if(enumerationIndexList == null)
\r
27 ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();
\r
28 for(Resource r : OrderedSetUtils.toList(graph, enumerationIndexList)) {
\r
29 result.add(new EnumerationIndexNode(r));
\r
35 public String getViewpointId() {
\r
36 return "Enumeration indexes";
\r