Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 419043

Summary: shift-selection of tree items is wrong, needs to remember a selection's anchor item
Product: [ECD] Orion Reporter: Grant Gayed <grant_gayed>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: grant_gayed
Version: 4.0Flags: grant_gayed: review+
Target Milestone: 4.0 RC2   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch file none

Description Grant Gayed CLA 2013-10-09 10:33:11 EDT
I20131009-0934

- assume a flat tree with items a, b, c, d, e, f, g
- select item c
- hold Shift and select item a
  -> selects items a - c, which is right
- now hold shift and select item g
  -> selection should become c - g, but instead is a - g
  -> item c needed to be remembered as the anchor item of the initial selection, from which subsequent shift-selections are resolved

- similar case, a bit different but same idea:
- select item a
- hold Shift and select item c
  -> selects items a - c, which is right
- now hold shift and select item g
  -> selection should become a - g, but instead is c - g
Comment 1 libing wang CLA 2013-10-09 11:00:47 EDT
Just to clarify:
All the non-shift single selection has to be the "shift selection anchor". 

Assume this flow:
1. Select a.
2. Hold Ctrl and select c.
3. Hold shift and select e.
4. Hold ctrl and select g.
Then a,c,d,e,g are select.

5. hold shift and select e
then g,f,e are selected.
Comment 2 Grant Gayed CLA 2013-10-09 11:25:52 EDT
(In reply to libing wang from comment #1)

I just tried this in Windows Explorer and the OS X Finder, and got slightly different results in them after your step 4:
- Windows Explorer: c,d,e,g are selected
- OS X Finder: a,c,d,e,g are selected

I like the OS X behaviour better, but I guess either of these would be fine, they both make sense in slightly different ways.
Comment 3 libing wang CLA 2013-10-09 16:39:42 EDT
Created attachment 236302 [details]
Patch file
Comment 4 libing wang CLA 2013-10-09 16:44:02 EDT
(In reply to Grant Gayed from comment #2)
> (In reply to libing wang from comment #1)
> 
> I just tried this in Windows Explorer and the OS X Finder, and got slightly
> different results in them after your step 4:
> - Windows Explorer: c,d,e,g are selected
> - OS X Finder: a,c,d,e,g are selected
> 
> I like the OS X behaviour better, but I guess either of these would be fine,
> they both make sense in slightly different ways.

I just implemented the windows explorer style.
Shift selection should always clear the existing selection and create a new range of selection, unless we can cached the previously selections by CTRL key.
Comment 5 libing wang CLA 2013-10-09 16:45:15 EDT
(In reply to libing wang from comment #3)
> Created attachment 236302 [details]
> Patch file
I think you can use Orion "apply patch" to review the changes.