Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 281534

Summary: [Tree] Double click does not toggle expanded state
Product: [RT] RAP Reporter: Nobody - feel free to take it <nobody>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: ivan
Version: 1.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch that solves the bug none

Description Nobody - feel free to take it CLA 2009-06-25 12:11:13 EDT
Build ID: RAP

Steps To Reproduce:
1. Run the snippet
2. Double click on a tree node
3. Nothing will happen

Expected: The expanded state toggles on double click.


More information:
public class TreeDoubleClickBug implements IEntryPoint {

    public int createUI() {
        Display display = new Display();

        final Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
        
        Tree tree = new Tree(shell, SWT.NONE);
        for (int i = 0; i < 3; i++) {
            TreeItem item = new TreeItem(tree, SWT.NONE);
            item.setText("item " + i);
            for (int j = 0; j < 3; j++) {
                TreeItem child = new TreeItem(item, SWT.NONE);
                child.setText("child " + i);
            }
        }
        
        shell.setSize(300, 300);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
        return 0;
    }
    
}
Comment 1 Ivan Furnadjiev CLA 2009-06-25 13:57:58 EDT
Created attachment 140137 [details]
Patch that solves the bug
Comment 2 Ivan Furnadjiev CLA 2009-06-26 04:35:14 EDT
One note: If there is a MouseListener attached, the mouseDoubleClick is not fired if you double click on tree item. This is true with useDoubleClick set to false too.
Comment 3 Ivan Furnadjiev CLA 2009-08-13 05:26:20 EDT
Applied patch to CVS HEAD.
Comment 4 Ralf Sternberg CLA 2009-08-17 15:43:55 EDT
I think this bug is invalid. SWT does not expand TreeItems on double click, at least not in GTK. IIRC, this was the reason for setting useDoubleClick to false.
Comment 5 Ivan Furnadjiev CLA 2009-08-17 15:51:54 EDT
On Windows it does. Tested with SWT Controls Demo ( SWT 3.5.0 ).
Comment 6 Ivan Furnadjiev CLA 2009-08-20 04:22:44 EDT
Revert the changes as we will respect the GTK behaviour here. If you need to toggle the expanded state you can do it manually in defaultSelection event, triggered on doubleClick.