X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.model%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fmodel%2Flabels%2FLabelContribution.java;h=25f0d054d5b55670c934940c993048fbcb728c79;hp=e8a7b62227db8d40ab51bb5ea978af1bb20dc322;hb=cf355af9bf70b9bafea8e45f763e341e50343732;hpb=7618c2e6ae913b67ca299a610ab393961e16ae05 diff --git a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labels/LabelContribution.java b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labels/LabelContribution.java index e8a7b6222..25f0d054d 100644 --- a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labels/LabelContribution.java +++ b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/labels/LabelContribution.java @@ -24,6 +24,7 @@ import org.simantics.browsing.ui.model.tests.Test; import org.simantics.browsing.ui.model.visuals.VisualsContribution; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.exception.PendingVariableException; /** * Produces labels for nodes of given node type. @@ -31,7 +32,7 @@ import org.simantics.db.exception.DatabaseException; */ public class LabelContribution extends VisualsContribution { LabelRule labelRule; - + public LabelContribution(NodeType nodeType, Test test, LabelRule labelRule, double priority) throws InvalidContribution { super(nodeType, test, priority); if(!labelRule.isCompatible( @@ -40,7 +41,7 @@ public class LabelContribution extends VisualsContribution { throw new InvalidContribution("Label rule is not compatible with the content type."); this.labelRule = labelRule; } - + /** * Returns a label for the node or null, if contribution is * not suitable for the input. @@ -48,15 +49,15 @@ public class LabelContribution extends VisualsContribution { public Map getLabel(ReadGraph graph, NodeContext context) { Object content = context.getConstant(BuiltinKeys.INPUT); try { - if(test == null || test.test(graph, content)) + if(test == null || test.test(graph, content)) return labelRule.getLabel(graph, content); else return null; + } catch(PendingVariableException e) { + return Collections.singletonMap(ColumnKeys.SINGLE, ""); } catch(DatabaseException e) { ErrorLogger.defaultLogError(e); - //Logger.defaultLogError(e); - // TODO reconsider return Collections.singletonMap(ColumnKeys.SINGLE, ""); } - } + } }