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%2FEvaluatorViewpoint.java;h=955c8b6be3ca9896936094887e7d571afa264b62;hp=fa4308424b21a52f02ef820d3214eb48d8744e45;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorViewpoint.java b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorViewpoint.java index fa4308424..955c8b6be 100644 --- a/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorViewpoint.java +++ b/bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorViewpoint.java @@ -1,58 +1,58 @@ -package org.simantics.browsing.ui.graph.impl; - -import java.util.Collection; - -import org.simantics.browsing.ui.BuiltinKeys.ViewpointKey; -import org.simantics.browsing.ui.NodeContext; -import org.simantics.browsing.ui.PrimitiveQueryUpdater; -import org.simantics.browsing.ui.model.browsecontexts.BrowseContext; -import org.simantics.db.ReadGraph; -import org.simantics.db.common.request.UniqueRead; -import org.simantics.db.exception.DatabaseException; - -public class EvaluatorViewpoint extends LazyViewpoint { - - final BrowseContext browseContext; - final boolean useNodeBrowseContexts; - final boolean useNodeActionContexts; - - public EvaluatorViewpoint(PrimitiveQueryUpdater updater, NodeContext context, ViewpointKey key, - BrowseContext browseContext, boolean useNodeBrowseContexts, boolean useNodeActionContexts) { - super(updater, context, key); - this.browseContext = browseContext; - this.useNodeActionContexts = useNodeActionContexts; - this.useNodeBrowseContexts = useNodeBrowseContexts; - } - - @Override - public Boolean hasChildren(ReadGraph graph) throws DatabaseException { - return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).hasChildren(graph, context); - } - - @Override - public NodeContext[] children(ReadGraph graph) throws DatabaseException { - boolean oldSynchronous = graph.setSynchronous(false); - try { - // This intermediate query is a work-around for a listening - // bug where old dependencies are not correctly pruned for listened entries - return graph.syncRequest(new UniqueRead() { - - @Override - public NodeContext[] perform(ReadGraph graph) throws DatabaseException { - BrowseContext bc = BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts); - Collection children = bc.getChildren(graph, context); - children = BrowseContext.augment(graph, bc, children, useNodeActionContexts); - return children.toArray(new NodeContext[children.size()]); - } - - }); - } finally { - graph.setSynchronous(oldSynchronous); - } - } - - public String toString() { - return "EvaluatorViewpoint[" + browseContext + "] " + context; - } - +package org.simantics.browsing.ui.graph.impl; + +import java.util.Collection; + +import org.simantics.browsing.ui.BuiltinKeys.ViewpointKey; +import org.simantics.browsing.ui.NodeContext; +import org.simantics.browsing.ui.PrimitiveQueryUpdater; +import org.simantics.browsing.ui.model.browsecontexts.BrowseContext; +import org.simantics.db.ReadGraph; +import org.simantics.db.common.request.UniqueRead; +import org.simantics.db.exception.DatabaseException; + +public class EvaluatorViewpoint extends LazyViewpoint { + + final BrowseContext browseContext; + final boolean useNodeBrowseContexts; + final boolean useNodeActionContexts; + + public EvaluatorViewpoint(PrimitiveQueryUpdater updater, NodeContext context, ViewpointKey key, + BrowseContext browseContext, boolean useNodeBrowseContexts, boolean useNodeActionContexts) { + super(updater, context, key); + this.browseContext = browseContext; + this.useNodeActionContexts = useNodeActionContexts; + this.useNodeBrowseContexts = useNodeBrowseContexts; + } + + @Override + public Boolean hasChildren(ReadGraph graph) throws DatabaseException { + return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).hasChildren(graph, context); + } + + @Override + public NodeContext[] children(ReadGraph graph) throws DatabaseException { + boolean oldSynchronous = graph.setSynchronous(false); + try { + // This intermediate query is a work-around for a listening + // bug where old dependencies are not correctly pruned for listened entries + return graph.syncRequest(new UniqueRead() { + + @Override + public NodeContext[] perform(ReadGraph graph) throws DatabaseException { + BrowseContext bc = BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts); + Collection children = bc.getChildren(graph, context); + children = BrowseContext.augment(graph, bc, children, useNodeActionContexts); + return children.toArray(new NodeContext[children.size()]); + } + + }); + } finally { + graph.setSynchronous(oldSynchronous); + } + } + + public String toString() { + return "EvaluatorViewpoint[" + browseContext + "] " + context; + } + } \ No newline at end of file