Community
Participate
Working Groups
Environment: Firefox 3.6.13/IE 8.0.7600 on Win7 The bug occurs only using RAP 1.4 M5. With 1.4 M4 it works correctly. Steps to reproduce: * create a tree viewer * add a IDoubleClickListener to the tree viewer * add drag support to the tree viewer * fill it with some items * double-click on any (not selected) item -> The IDoubleClickListener is called as expected * select one item * double-click on the selected item -> The IDoubleClickListener is not called Expected: The IDoubleClickListener is called on every double-click. Here is a snippet to reproduce: public class Snippet implements IEntryPoint { public int createUI() { Display display = new Display(); Shell shell = new Shell(display, SWT.TITLE); createContent(shell); shell.layout(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return 0; } private void createContent(Shell shell) { shell.setLayout(new GridLayout(1, false)); Tree tree = new Tree(shell, SWT.NONE | SWT.MULTI); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TreeViewer viewer = new TreeViewer(tree); viewer.setLabelProvider(new LabelProvider()); viewer.setContentProvider(new ITreeContentProvider() { public Object[] getElements(Object inputElement) { return new Object[] {"Root"}; } public Object[] getChildren(Object parentElement) { if (hasChildren(parentElement)) { String[] input = new String[10]; for (int i = 0; i < input.length; i++) { input[i] = "Item " + i; } return input; } return new Object[0]; } public boolean hasChildren(Object element) { return element.toString().startsWith("Root"); } public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public Object getParent(Object element) { return null; } }); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { MessageDialog.openInformation(shell, "Test", "Doubleclicked"); } }); viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK, new Transfer[] {TextTransfer.getInstance()}, new DragSourceAdapter()); viewer.setInput(new Object[0]); viewer.expandAll(); } }
Just a wild guess: perhaps this issue is related to bug 334101
That(In reply to comment #1) > Just a wild guess: perhaps this issue is related to bug 334101 That would be a pretty good guess. I think the double-click detection fails because the item does not get focused on mousedown in this scenario. Not yet sure how to handle this, needs some research.
Marking as P1 because it's a regression.
Fixed CVS HEAD. The issue was acutally that due to the fix for bug 334101, the double click detection wass called twice for one click, canceling each other out.