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%2FEvaluatorLabeler.java;fp=bundles%2Forg.simantics.browsing.ui.graph.impl%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fgraph%2Fimpl%2FEvaluatorLabeler.java;h=222c0e261a4d04af05c4a21726339b857d49f40e;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorLabeler.java b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorLabeler.java new file mode 100644 index 000000000..222c0e261 --- /dev/null +++ b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorLabeler.java @@ -0,0 +1,58 @@ +package org.simantics.browsing.ui.graph.impl; + +import java.util.Map; + +import org.simantics.browsing.ui.BuiltinKeys.LabelerKey; +import org.simantics.browsing.ui.NodeContext; +import org.simantics.browsing.ui.PrimitiveQueryUpdater; +import org.simantics.browsing.ui.graph.impl.contribution.LabelerContributionImpl; +import org.simantics.browsing.ui.model.browsecontexts.BrowseContext; +import org.simantics.db.ReadGraph; +import org.simantics.db.UndoContext; +import org.simantics.db.exception.DatabaseException; + +public class EvaluatorLabeler extends LabelerContributionImpl { + + final BrowseContext browseContext; + final boolean useNodeBrowseContexts; + + public EvaluatorLabeler(PrimitiveQueryUpdater updater, NodeContext context, + LabelerKey key, + BrowseContext browseContext, boolean useNodeBrowseContexts) { + super(updater, context, key); + this.browseContext = browseContext; + this.useNodeBrowseContexts = useNodeBrowseContexts; + } + + @Override + public Map labels( + ReadGraph graph, + NodeContext context) + throws DatabaseException { + boolean oldSynchronous = graph.setSynchronous(false); + try { + return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).getLabel(graph, context); + } finally { + graph.setSynchronous(oldSynchronous); + } + } + + @Override + public int category(ReadGraph graph, + NodeContext context) + throws DatabaseException { + return 0; + } + + public Modifier + getModifier(ReadGraph graph, UndoContext undoContext, + NodeContext context, String columnKey) throws DatabaseException { + return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).getModifier(graph, context, columnKey); + } + + public String toString() { + return "EvaluatorLabeler[" + browseContext + "] " + context; + } + + +}