X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FGraphExplorerImpl.java;h=3085e6f07e58890a7bce4368ff8c63fa939e9ff6;hp=0978ddb70f35585ffc70cee347f0dcc33bb5aa45;hb=96bb7ef9cbe42d82eb58306d8f9b62392cc29ba8;hpb=ae5bb63c5c88f6569518fed2a24df86fbd0570ff diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java index 0978ddb70..3085e6f07 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java @@ -83,6 +83,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.ScrollBar; +import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; @@ -934,7 +935,11 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph deactivateEditingContext(); } }); - editor.setEditor(control, item, columnIndex); + + if (!(control instanceof Shell)) { + editor.setEditor(control, item, columnIndex); + } + control.setFocus(); @@ -1356,6 +1361,8 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph setBasicListeners(); setDefaultProcessors(); + + this.toolTip = new GraphExplorerToolTip(explorerContext, tree); } @Override @@ -1366,6 +1373,8 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph TreeItem previousSingleSelection = null; long focusGainedAt = Long.MIN_VALUE; + protected GraphExplorerToolTip toolTip; + protected void setBasicListeners() { // Keep track of the previous single selection to help // decide whether to start editing a tree node on mouse @@ -1961,6 +1970,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph GENodeQueryManager manager = new GENodeQueryManager(newContext, null, null, TreeItemReference.create(null)); this.explorerContext = newContext; oldContext.safeDispose(); + toolTip.setGraphExplorerContext(explorerContext); // Need to empty these or otherwise they won't be emptied until the // explorer is disposed which would mean that many unwanted references @@ -3546,5 +3556,20 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph this.focusService = (IFocusService) serviceLocator.getService(IFocusService.class); } } + + @Override + public Object getClicked(Object event) { + MouseEvent e = (MouseEvent)event; + final Tree tree = (Tree) e.getSource(); + Point point = new Point(e.x, e.y); + TreeItem item = tree.getItem(point); + + // No selectable item at point? + if (item == null) + return null; + + Object data = item.getData(); + return data; + } }