### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.navigator Index: src/org/eclipse/ui/navigator/CommonViewer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonViewer.java,v retrieving revision 1.27 diff -u -r1.27 CommonViewer.java --- src/org/eclipse/ui/navigator/CommonViewer.java 22 May 2007 19:22:21 -0000 1.27 +++ src/org/eclipse/ui/navigator/CommonViewer.java 12 Feb 2008 09:01:16 -0000 @@ -24,8 +24,11 @@ import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.navigator.ContributorTrackingSet; @@ -329,6 +332,24 @@ } } + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.AbstractTreeViewer#hookEditingSupport(Control) + */ + protected void hookEditingSupport(Control control) { + // FIXME - This caching thing should not be here; it's brittle. + // The underlying problem of over-calling of getSelection() should + // be addressed instead (see bugs 144294 and 140032) + // The DragStart event will come before the SelectionEvent on + // some platforms (GTK). Since DragStart can turn around and + // call getSelection(), we need to clear the cache. + control.addMouseListener(new MouseAdapter() { + public void mouseDown(MouseEvent e) { + clearSelectionCache(); + } + }); + } + + /* (non-Javadoc) * @see org.eclipse.jface.viewers.AbstractTreeViewer#setSelectionToWidget(java.util.List, boolean) */