X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.graph.impl%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fgraph%2Fimpl%2FGetEnumerationValue.java;h=0f9d119aca3400a7cd6fbb32ff866514c0de50a8;hp=c246e7bd9091f5142014ccc37acf53d8250e0372;hb=3a25ce941361ea625bc07a427b0574fe5cb17180;hpb=46cdf23c4ea4733a3acbfd5c9895ec9e65965c7d diff --git a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GetEnumerationValue.java b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GetEnumerationValue.java index c246e7bd9..0f9d119ac 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GetEnumerationValue.java +++ b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/GetEnumerationValue.java @@ -42,6 +42,14 @@ public class GetEnumerationValue extends ResourceRead return enumerate(graph, resource); } + public static String getEnumerationValueName(ReadGraph graph, Resource resource) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(graph); + String label = graph.getPossibleRelatedValue(resource, L0.HasLabel, Bindings.STRING); + if(label != null) + return label; + return safeName(graph, resource); + } + public static EnumerationValue enumerate(ReadGraph graph, Resource resource) throws DatabaseException { Layer0 l0 = Layer0.getInstance(graph); Set types = graph.getTypes(resource); @@ -61,7 +69,7 @@ public class GetEnumerationValue extends ResourceRead Collection values = graph.getObjects(type, l0.ConsistsOf); List> result = new ArrayList>(values.size()); for (Resource value : values) { - result.add(new EnumeratedValue(safeName(graph, value), value)); + result.add(new EnumeratedValue(getEnumerationValueName(graph, value), value)); } Enumeration enumeration = new Enumeration(result); return new EnumerationValue(enumeration, enumeration.find(resource));