X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.selectionview%2Fsrc%2Forg%2Fsimantics%2Fselectionview%2Ffunction%2FAll.java;h=79541b06134deb344a5f6f71c4dda854edcfc145;hp=150bbb8252346f61bfe6b6aca6b8eef3ff8d9a11;hb=8d9659a857fb83a9fdb5c9c8663302765fddd3e8;hpb=3f5adda763f6281e9988277d067c1f71615e3da2 diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/function/All.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/function/All.java index 150bbb825..79541b061 100644 --- a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/function/All.java +++ b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/function/All.java @@ -53,7 +53,9 @@ import org.simantics.scl.compiler.types.TVar; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; import org.simantics.scl.reflection.annotations.SCLValue; +import org.simantics.scl.runtime.function.Function1; import org.simantics.selectionview.SelectionInput; +import org.simantics.selectionview.SelectionViewResources; import org.simantics.selectionview.StandardSelectionInput; import org.simantics.ui.colors.Colors; import org.simantics.ui.fonts.Fonts; @@ -208,6 +210,9 @@ public class All { public static Object getPropertyChildName(ReadGraph graph, Resource resource, Object context) throws DatabaseException { if(context instanceof Variable) { Variable variable = (Variable)context; + String label = variable.getParent(graph).getPossiblePropertyValue(graph, "HasLabel", Bindings.STRING); + if(label != null) + return label; return variable.getParent(graph).getName(graph); } throw new DatabaseException("Unknown context " + context); @@ -293,19 +298,6 @@ public class All { } - if(!asserted) { - Resource assertedObject = Layer0Utils.getPossibleAssertedObject(graph, container, property); - if(assertedObject != null) { - if(graph.isInstanceOf(assertedObject, newType)) { - Object assertedValue = graph.getValue(assertedObject, (Binding)_binding); - if(assertedValue.equals(value)) { - graph.deny(container, property); - return null; - } - } - } - } - Datatype datatype = variable.getDatatype(graph); Binding binding = (Binding)_binding; Layer0Utils.claimAdaptedValue(graph, objectResource, value, binding, datatype); @@ -461,15 +453,20 @@ public class All { Object value = null; Resource formatter = property.getPossiblePropertyValue(graph, Variables.FORMATTER); if(formatter != null) { - Formatter fmt = graph.adaptContextual(formatter, property, Variable.class, Formatter.class); value = fmt.format(property.getValue(graph)); - - } else { + } + if(value == null) { + SelectionViewResources SEL = SelectionViewResources.getInstance(graph); + Function1 formatterFunction = property.getPossiblePropertyValue(graph, SEL.formatter); + if(formatterFunction != null) { + value = formatterFunction.apply(property.getValue(graph)); + } + } + if(value == null) { Variant variant = property.getVariantValue(graph); value = variant.getValue(); - Binding binding = variant.getBinding(); if(binding != null) { Datatype dt = binding.type();