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%2FGraphExplorerMouseAdapter.java;h=77b1b1a5355294f4007c69a6b71ffb4995724f05;hp=9a28ed4f2f3df09ed8a33c60d25137acec94cdaf;hb=96bb7ef9cbe42d82eb58306;hpb=ae5bb63c5c88f6569518fed2a24df86fbd0570ff diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerMouseAdapter.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerMouseAdapter.java index 9a28ed4f2..77b1b1a53 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerMouseAdapter.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerMouseAdapter.java @@ -16,9 +16,7 @@ import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.swt.widgets.Control; import org.simantics.browsing.ui.GraphExplorer; import org.simantics.browsing.ui.NodeContext; import org.simantics.utils.ui.AdaptionUtils; @@ -47,15 +45,19 @@ public class GraphExplorerMouseAdapter extends MouseAdapter { } protected ISelection getClickedContext(MouseEvent e) { - 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(); +// 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(); + Object data = ge.getClicked(e); + if (data == null) + return null; + NodeContext context = AdaptionUtils.adaptToSingle(data, NodeContext.class); if (context == null) return null; @@ -81,11 +83,11 @@ public class GraphExplorerMouseAdapter extends MouseAdapter { if (context == null) return; - Tree tree = (Tree) e.getSource(); + Control tree = (Control)e.getSource(); handleContextDoubleClick(tree, context); } - protected void handleContextDoubleClick(Tree tree, ISelection selection) { + protected void handleContextDoubleClick(Control tree, ISelection selection) { } }