Bug 552749

Summary: [Cocoa] Tree expansion/collapse should have a post event
Product: [Eclipse Project] Platform Reporter: Hugo Almeida <hugoalmeida1211>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.13   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Hugo Almeida CLA 2019-11-06 10:37:37 EST
void sendExpand (boolean expand, boolean recurse) {
	if (itemCount == 0) return;
	if (expanded != expand) {
		Event event = new Event ();
		event.item = this;
		parent.sendEvent (expand ? SWT.Expand : SWT.Collapse, event);
		if (isDisposed ()) return;
		expanded = expand;
	}
	if (recurse) {
		for (int i = 0; i < itemCount; i++) {
			if (items[i] != null) items[i].sendExpand (expand, recurse);
		}
	}
}

That is the code snippet that is run when a TreeItem is expanded or collapsed. The events are fired before the expanded flag is actually changed.

This means that if you are trying to do something with the new Tree state, you will instead get an outdated tree state.

There should be an event fired after all TreeItems have been expanded/collapsed.