Bug 569469

Summary: AbstractTreeViewer collapseAll() sets selection on first element on WIN
Product: [Eclipse Project] Platform Reporter: Nicolas Huber <nicolas.huber>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.19   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Nicolas Huber CLA 2020-12-04 09:45:48 EST
I found out that when calling collapseAll() on a treeViewer, depending on the operating system the first element of the tree is selected or not.
On Windows the first item in the tree is selected. On Mac the first item in the tree is not selected. 
So if "link with editor" is enabled and you press a "collapse all" button (f.ex. in outline view) on Windows the editor jumps to the source code position of the first element of the tree, because it is selected in the tree. On mac the editor stays where it is.

In the plugin for Windows org.eclipse.swt.win32.win32.x86_64....jar
in TreeItem.class (org.eclipse.swt.widgets) in method setExpanded(boolean expanded) a Selection Event is sent:
parent.sendSelectionEvent (SWT.Selection, event, true);

In the mac implementation the event is not sent.

Why does collapseAll() work different for these operating systems?
Is it intended or is it a bug?