1 package org.simantics.sysdyn.ui.properties.widgets.arrays;
\r
3 import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;
\r
4 import org.simantics.db.ReadGraph;
\r
5 import org.simantics.db.Resource;
\r
6 import org.simantics.db.exception.DatabaseException;
\r
7 import org.simantics.layer0.Layer0;
\r
9 public class EnumerationIndexLabeler extends LabelerContributor<EnumerationIndexNode>{
\r
12 public String getLabel(ReadGraph graph, EnumerationIndexNode index) throws DatabaseException {
\r
13 Resource r = index.data;
\r
14 if(r == null) return "Null resource";
\r
15 String name = graph.getPossibleRelatedValue(r, Layer0.getInstance(graph).HasName);
\r
16 return name == null ? "No name" : name;
\r