Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343778 - single-click select in multiple selection in tree fails to update selection for StructuredViewer
Summary: single-click select in multiple selection in tree fails to update selection f...
Status: CLOSED DUPLICATE of bug 355200
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6.2   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: 2011-04-25 18:03 EDT by Andrew Bachmann CLA
Modified: 2012-08-07 05:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Bachmann CLA 2011-04-25 18:03:01 EDT
Build Identifier: 20110218-0911

If you select multiple items in a tree widget, and then click on one of the selected items, the others visually deselect but there is no selection event generated.

Looking at StructuredViewer.handleSelect, the result of "getSelection()" when this code is reached is the selection of multiple items, not the new selection of a single item.

This behavior apparently started in Eclipse 3.6.1  (Eclipse 3.6.0 works properly)

As a workaround, we overrode StructuredViewer.handleSelect(SelectionEvent event) with the following:
if (event.stateMask == 0) {
   Widget item = event.item;
   setSelection(Collections.singletonList(item));
}
super.handleSelect(event);

Reproducible: Always

Steps to Reproduce:
1. Open the properties view in Eclipse
2. select a package in the Package Explorer
3. Note the properties view shows the details for the selection
4. Use shift-select to select multiple packages
5. Note the properties view shows no details for a multi-selection
6. Single click on one of the selected packages
7. Note the properties view still shows no details

Clicking off the package and back on reveals details.
Comment 1 Andrew Bachmann CLA 2011-04-25 18:28:51 EDT
This behavior does not happen on Linux.
Comment 2 Andrew Bachmann CLA 2011-05-06 17:24:51 EDT
The (In reply to comment #0)

> As a workaround, we overrode StructuredViewer.handleSelect(SelectionEvent
> event) with the following:
> if (event.stateMask == 0) {
>    Widget item = event.item;
>    setSelection(Collections.singletonList(item));
> }
> super.handleSelect(event);

The above patch is not a satisfactory workaround because it messes up dragging a multi-selection.
Comment 3 Lakshmi P Shanmugam CLA 2012-08-07 05:15:09 EDT
.

*** This bug has been marked as a duplicate of bug 355200 ***