Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370067 - expanded state inconsistent changing sub items count
Summary: expanded state inconsistent changing sub items count
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-29 08:46 EST by zzzz CLA
Modified: 2019-10-21 14:59 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zzzz CLA 2012-01-29 08:46:52 EST
If an item has subitems, when setting subitems to zero, the expanded state never change, for example if the node was expanded, remain expanded.
Then when the sub items is zero, you can't more change the expand state

In my opionion this is not correct, and when use a virtual tree, the problem is propagated in the SetData event


Forcing setExpanded(false) is not a solution because this can generate unwanted selections event 


Code:


        Display display = new Display ();
        Shell shell = new Shell(display);
     
        Tree t = new Tree(shell, SWT.NONE);
        t.setBounds(0,0,400,400);

        TreeItem t1 = new TreeItem(t, SWT.NONE);
        t1.setText("A");
        TreeItem t2 = new TreeItem(t1, SWT.NONE);  
        t2.setText("B");

        
        t1.setExpanded(true);
        System.out.println( "expanded = " + t1.getExpanded() );

        t1.setItemCount(0);
        System.out.println( "expanded = " + t1.getExpanded() );

        t1.setExpanded(false);
        System.out.println( "expanded = " + t1.getExpanded() );
        
        shell.open ();
        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
Comment 1 Eclipse Genie CLA 2019-10-21 14:59:14 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.