-package org.simantics.browsing.ui.graph.impl;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.browsing.ui.BuiltinKeys.ViewpointKey;\r
-import org.simantics.browsing.ui.NodeContext;\r
-import org.simantics.browsing.ui.PrimitiveQueryUpdater;\r
-import org.simantics.browsing.ui.model.browsecontexts.BrowseContext;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.common.request.UniqueRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-public class EvaluatorViewpoint extends LazyViewpoint {\r
-\r
- final BrowseContext browseContext;\r
- final boolean useNodeBrowseContexts;\r
- final boolean useNodeActionContexts;\r
- \r
- public EvaluatorViewpoint(PrimitiveQueryUpdater updater, NodeContext context, ViewpointKey key,\r
- BrowseContext browseContext, boolean useNodeBrowseContexts, boolean useNodeActionContexts) {\r
- super(updater, context, key);\r
- this.browseContext = browseContext;\r
- this.useNodeActionContexts = useNodeActionContexts;\r
- this.useNodeBrowseContexts = useNodeBrowseContexts;\r
- }\r
-\r
- @Override\r
- public Boolean hasChildren(ReadGraph graph) throws DatabaseException {\r
- return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).hasChildren(graph, context);\r
- }\r
-\r
- @Override\r
- public NodeContext[] children(ReadGraph graph) throws DatabaseException {\r
- boolean oldSynchronous = graph.setSynchronous(false); \r
- try {\r
- // This intermediate query is a work-around for a listening\r
- // bug where old dependencies are not correctly pruned for listened entries\r
- return graph.syncRequest(new UniqueRead<NodeContext[]>() {\r
-\r
- @Override\r
- public NodeContext[] perform(ReadGraph graph) throws DatabaseException {\r
- BrowseContext bc = BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts);\r
- Collection<NodeContext> children = bc.getChildren(graph, context);\r
- children = BrowseContext.augment(graph, bc, children, useNodeActionContexts);\r
- return children.toArray(new NodeContext[children.size()]);\r
- }\r
- \r
- });\r
- } finally {\r
- graph.setSynchronous(oldSynchronous);\r
- }\r
- }\r
- \r
- public String toString() {\r
- return "EvaluatorViewpoint[" + browseContext + "] " + context;\r
- }\r
- \r
+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<NodeContext[]>() {
+
+ @Override
+ public NodeContext[] perform(ReadGraph graph) throws DatabaseException {
+ BrowseContext bc = BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts);
+ Collection<NodeContext> 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