X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.selectionview%2Fsrc%2Forg%2Fsimantics%2Fselectionview%2FVariablePropertyLabelRule.java;h=3b76d6177e7f2a42070463c354b02d1c6f9bb7fe;hb=HEAD;hp=9bce1aef1f27f0cad00f9f6b6d6212a0322da778;hpb=873afce76b92cb7cf9094fe60e407278f220e5ed;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/VariablePropertyLabelRule.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/VariablePropertyLabelRule.java index 9bce1aef1..3b76d6177 100644 --- a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/VariablePropertyLabelRule.java +++ b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/VariablePropertyLabelRule.java @@ -1,41 +1,41 @@ -package org.simantics.selectionview; - -import java.util.HashMap; -import java.util.Map; - -import org.simantics.browsing.ui.model.labels.LabelRule; -import org.simantics.databoard.Bindings; -import org.simantics.db.ReadGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.db.layer0.variable.Variables; - -public class VariablePropertyLabelRule implements LabelRule { - - @Override - public boolean isCompatible(Class contentType) { - return contentType.equals(Variable.class); - } - - @Override - public Map getLabel(ReadGraph graph, Object content) - throws DatabaseException { - - Variable variable = (Variable)content; - - Map result = new HashMap(); - - for(Variable property : variable.getProperties(graph)) { - String column = property.getPossiblePropertyValue(graph, Variables.DISPLAY_COLUMN); - if(column != null) { - String value = property.getPossibleValue(graph, Bindings.STRING); - if (value != null) - result.put(column, value); - } - } - - return result; - - } - -} +package org.simantics.selectionview; + +import java.util.HashMap; +import java.util.Map; + +import org.simantics.browsing.ui.model.labels.LabelRule; +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.db.layer0.variable.Variables; + +public class VariablePropertyLabelRule implements LabelRule { + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(Variable.class); + } + + @Override + public Map getLabel(ReadGraph graph, Object content) + throws DatabaseException { + + Variable variable = (Variable)content; + + Map result = new HashMap(); + + for(Variable property : variable.getProperties(graph)) { + String column = property.getPossiblePropertyValue(graph, Variables.DISPLAY_COLUMN); + if(column != null) { + String value = property.getPossibleValue(graph, Bindings.STRING); + if (value != null) + result.put(column, value); + } + } + + return result; + + } + +}