]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/EvaluatorLabeler.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.graph.impl / src / org / simantics / browsing / ui / graph / impl / EvaluatorLabeler.java
index 9e0b7b5380d60436e7f7e5abd564da1c4dc2b5e3..dc61da00590f57926506710de4b7eedf8f65e6a5 100644 (file)
@@ -1,94 +1,94 @@
-package org.simantics.browsing.ui.graph.impl;\r
-\r
-import java.util.Map;\r
-\r
-import org.simantics.browsing.ui.BuiltinKeys.LabelerKey;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.simantics.Simantics;\r
-import org.simantics.browsing.ui.NodeContext;\r
-import org.simantics.browsing.ui.PrimitiveQueryUpdater;\r
-import org.simantics.browsing.ui.graph.impl.contribution.LabelerContributionImpl;\r
-import org.simantics.browsing.ui.model.browsecontexts.BrowseContext;\r
-import org.simantics.browsing.ui.model.tooltips.TooltipContribution;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.UndoContext;\r
-import org.simantics.db.common.request.UniqueRead;\r
-import org.simantics.db.common.utils.RequestUtil;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.ui.SimanticsUI;\r
-\r
-public class EvaluatorLabeler extends LabelerContributionImpl {\r
-       \r
-       final BrowseContext browseContext;\r
-       final boolean useNodeBrowseContexts;\r
-       \r
-    private TooltipContribution currentTooltipContribution;\r
-       \r
-    public EvaluatorLabeler(PrimitiveQueryUpdater updater, NodeContext context,\r
-                       LabelerKey key,\r
-                       BrowseContext browseContext, boolean useNodeBrowseContexts) {\r
-               super(updater, context, key);\r
-               this.browseContext = browseContext;\r
-               this.useNodeBrowseContexts = useNodeBrowseContexts;\r
-       }\r
-\r
-       @Override\r
-    public Map<String, String> labels(\r
-            ReadGraph graph,\r
-            NodeContext context)\r
-            throws DatabaseException {\r
-       boolean oldSynchronous = graph.setSynchronous(false); \r
-       try {\r
-               return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).getLabel(graph, context);\r
-       } finally {\r
-               graph.setSynchronous(oldSynchronous);\r
-       }\r
-    }\r
-\r
-    @Override\r
-    public int category(ReadGraph graph,\r
-            NodeContext context)\r
-    throws DatabaseException {\r
-        return 0;\r
-    }\r
-    \r
-    public Modifier \r
-    getModifier(ReadGraph graph, UndoContext undoContext, \r
-            NodeContext context, String columnKey) throws DatabaseException {\r
-        return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).getModifier(graph, context, columnKey);\r
-    }\r
-    \r
-    public String toString() {\r
-       return "EvaluatorLabeler[" + browseContext + "] " + context;\r
-    }\r
-    \r
-    \r
-    @Override\r
-    public boolean shouldCreateToolTip(Event event, NodeContext context) {\r
-        try {\r
-            currentTooltipContribution = RequestUtil.trySyncRequest(\r
-                    Simantics.getSession(),\r
-                    SimanticsUI.UI_THREAD_REQUEST_START_TIMEOUT,\r
-                    SimanticsUI.UI_THREAD_REQUEST_EXECUTION_TIMEOUT,\r
-                    null,\r
-                    new UniqueRead<TooltipContribution>() {\r
-                @Override\r
-                public TooltipContribution perform(ReadGraph graph) throws DatabaseException {\r
-                    return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).shouldCreateToolTip(graph, event, context);\r
-                }\r
-            });\r
-            if (currentTooltipContribution != null)\r
-                return true;\r
-        } catch (DatabaseException | InterruptedException e) {\r
-            e.printStackTrace();\r
-        }\r
-        return false;\r
-    }\r
-    \r
-    @Override\r
-    public Composite createToolTipContentArea(Event event, Composite parent, NodeContext nodeContext) {\r
-        return (Composite) currentTooltipContribution.getTooltip(event, parent, nodeContext);\r
-    }\r
-\r
-}\r
+package org.simantics.browsing.ui.graph.impl;
+
+import java.util.Map;
+
+import org.simantics.browsing.ui.BuiltinKeys.LabelerKey;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.simantics.Simantics;
+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.browsing.ui.model.tooltips.TooltipContribution;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.UndoContext;
+import org.simantics.db.common.request.UniqueRead;
+import org.simantics.db.common.utils.RequestUtil;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.ui.SimanticsUI;
+
+public class EvaluatorLabeler extends LabelerContributionImpl {
+       
+       final BrowseContext browseContext;
+       final boolean useNodeBrowseContexts;
+       
+    private TooltipContribution currentTooltipContribution;
+       
+    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<String, String> 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;
+    }
+    
+    
+    @Override
+    public boolean shouldCreateToolTip(Event event, NodeContext context) {
+        try {
+            currentTooltipContribution = RequestUtil.trySyncRequest(
+                    Simantics.getSession(),
+                    SimanticsUI.UI_THREAD_REQUEST_START_TIMEOUT,
+                    SimanticsUI.UI_THREAD_REQUEST_EXECUTION_TIMEOUT,
+                    null,
+                    new UniqueRead<TooltipContribution>() {
+                @Override
+                public TooltipContribution perform(ReadGraph graph) throws DatabaseException {
+                    return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).shouldCreateToolTip(graph, event, context);
+                }
+            });
+            if (currentTooltipContribution != null)
+                return true;
+        } catch (DatabaseException | InterruptedException e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+    
+    @Override
+    public Composite createToolTipContentArea(Event event, Composite parent, NodeContext nodeContext) {
+        return (Composite) currentTooltipContribution.getTooltip(event, parent, nodeContext);
+    }
+
+}