Bug 552749 - [Cocoa] Tree expansion/collapse should have a post event
Summary: [Cocoa] Tree expansion/collapse should have a post event
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.13   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-06 10:37 EST by Hugo Almeida CLA
Modified: 2019-11-06 15:44 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.