]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java
Sync git svn branch with SVN repository r33144.
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / GraphExplorerImpl.java
index 0978ddb70f35585ffc70cee347f0dcc33bb5aa45..3085e6f07e58890a7bce4368ff8c63fa939e9ff6 100644 (file)
@@ -83,6 +83,7 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;\r
 import org.eclipse.swt.widgets.Listener;\r
 import org.eclipse.swt.widgets.ScrollBar;\r
+import org.eclipse.swt.widgets.Shell;\r
 import org.eclipse.swt.widgets.Text;\r
 import org.eclipse.swt.widgets.Tree;\r
 import org.eclipse.swt.widgets.TreeColumn;\r
@@ -934,7 +935,11 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
                 deactivateEditingContext();\r
             }\r
         });\r
-        editor.setEditor(control, item, columnIndex);\r
+        \r
+        if (!(control instanceof Shell)) {\r
+            editor.setEditor(control, item, columnIndex);\r
+        }\r
+        \r
 \r
         control.setFocus();\r
 \r
@@ -1356,6 +1361,8 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
 \r
         setBasicListeners();\r
         setDefaultProcessors();\r
+        \r
+        this.toolTip = new GraphExplorerToolTip(explorerContext, tree);\r
     }\r
 \r
     @Override\r
@@ -1366,6 +1373,8 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
     TreeItem previousSingleSelection = null;\r
     long focusGainedAt = Long.MIN_VALUE;\r
 \r
+    protected GraphExplorerToolTip toolTip;\r
+\r
     protected void setBasicListeners() {\r
         // Keep track of the previous single selection to help\r
         // decide whether to start editing a tree node on mouse\r
@@ -1961,6 +1970,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
         GENodeQueryManager manager = new GENodeQueryManager(newContext, null, null, TreeItemReference.create(null));\r
         this.explorerContext = newContext;\r
         oldContext.safeDispose();\r
+        toolTip.setGraphExplorerContext(explorerContext);\r
 \r
         // Need to empty these or otherwise they won't be emptied until the\r
         // explorer is disposed which would mean that many unwanted references\r
@@ -3546,5 +3556,20 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
             this.focusService = (IFocusService) serviceLocator.getService(IFocusService.class);\r
         }\r
     }\r
+    \r
+    @Override\r
+    public Object getClicked(Object event) {\r
+       MouseEvent e = (MouseEvent)event;\r
+       final Tree tree = (Tree) e.getSource();\r
+        Point point = new Point(e.x, e.y);\r
+        TreeItem item = tree.getItem(point);\r
+\r
+        // No selectable item at point?\r
+        if (item == null)\r
+            return null;\r
+\r
+        Object data = item.getData();\r
+        return data;\r
+    }\r
 \r
 }\r