Bug 100565 - [Viewers] Tree viewer selection not revealed if unchanged
Summary: [Viewers] Tree viewer selection not revealed if unchanged
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.1 RC4   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-17 09:15 EDT by Boris Bokowski CLA
Modified: 2005-06-22 11:21 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Bokowski CLA 2005-06-17 09:15:28 EDT
[RC3]

Steps:

1. Check out org.eclipse.ui.workbench
2. Open Workbench.java
3. Ctrl-O to open Quick Outline
4. Type "r", note that the field "runEventLoop" is the first match
5. Type "u", note that the field is not shown anymore
6. Type arrow-down key, note that you cannot see the selected entry
Comment 1 Dani Megert CLA 2005-06-17 09:20:59 EDT
any filters enabled?
Comment 2 Dani Megert CLA 2005-06-17 09:25:09 EDT
anything in .log?
do you sort?
Comment 3 Boris Bokowski CLA 2005-06-17 09:40:11 EDT
Nothing in the log.

I was using a fresh workspace with just the one project, and I did not change 
any of the preferences.

Should be easy to reproduce. Sorry for the [RC3] it should really be 
[I20050617-0010].

I just tried older builds. It seems the problem was introduced between 
N20050503-0010 and M7.
Comment 4 Boris Bokowski CLA 2005-06-17 09:43:18 EDT
Turn on sorting and the problem goes away.

With regards to filtering, only the standard filters are enabled (import 
declarations, synthetic members).
Comment 5 Dani Megert CLA 2005-06-17 10:13:21 EDT
>I just tried older builds. It seems the problem was introduced between 
>N20050503-0010 and M7.
Did it really work in M7? I so, it must be caused by some change(s) in Platform
UI / JFace since we didn't touch that code since January.
Comment 6 Boris Bokowski CLA 2005-06-17 10:21:10 EDT
It works in N20050503-0010 (the oldest build I have around), but does not work 
in M7.
Comment 7 Dani Megert CLA 2005-06-17 10:52:45 EDT
We can't reproduce, neither on WindowsXP nor Linux.
Comment 8 Dani Megert CLA 2005-06-17 11:07:43 EDT
Ah, I now see it: it's not filtered but still selected but the tree viewer
scrolls fully down for whatever reason. If you manually scroll up you'll see the
item selected. This does not happen on Linux-GTK.

Either TreeViewer or Tree problem. Moving to Platform UI first.
Comment 9 Boris Bokowski CLA 2005-06-17 11:28:41 EDT
This is indeed a problem in our code.

The bug was introduced by the fix to bug 59037 [Navigator] Package explorer 
flicker when switching/closing editors.

The following code in AbstractTreeViewer.setSelectionToWidget was commented 
out:

if (reveal && newSelection.size() > 0) {
    showItem((Item) newSelection.get(0));
}

by doing that, the boolean "reveal" argument of setSelectionToWidget is not 
honored.

CCing Nick and MVM.
Comment 10 Tod Creasey CLA 2005-06-17 13:33:09 EDT
Moving to Nick as he implemented the fix to Bug 59037
Comment 11 Nick Edgar CLA 2005-06-17 13:36:42 EDT
Should fix for RC4.  The fix is to uncomment the commented-out code (the 3 lines
in comment 9).

The code was commented out because it is redundant when the selection is already
being set in the Tree.  SWT guarantees that setting the selection will make it
visible.  However, in this case AbstractTreeViewer.setSelection detects that the
selection is unchanged, and does not set it in the Tree, so the selection is not
made visible.

The fix is low risk, as this is how it worked before the fix to bug 59037.
Comment 12 Nick Edgar CLA 2005-06-17 13:38:09 EDT
Note that the rest of the changes for bug 59037 do not need to be undone.
The 3 lines here were commented out as an attempted optimization.
Comment 13 Dani Megert CLA 2005-06-17 14:40:15 EDT
+1 for 3.1 RC4. I would like to see this fixed in 3.1.
Comment 14 Michael Van Meekeren CLA 2005-06-21 08:32:32 EDT
to be reviewed June 21
Comment 15 Michael Van Meekeren CLA 2005-06-21 11:04:12 EDT
approved please fix for RC4
Comment 16 Nick Edgar CLA 2005-06-21 12:56:44 EDT
The check for same selection in TreeViewer.setSelection was added in v1.11 of
TreeViewer (by Tod), as part of the fix for bug 42175.
With the removal of get/setTopItem from this code in v1.15 (by me), it's unclear
whether this check is still needed.

In any case, the lower risk fix for 3.1 is to just uncomment the three lines in
AbstractTreeViewer.setSelectionToWidget.

Comment 17 Nick Edgar CLA 2005-06-21 13:04:22 EDT
Fixed in >N20050621.  Fix reviewed by Tod.
No performance impact is expected by this change, but we'll check the
performance tests in the nightly build anyway.
Comment 18 Nick Edgar CLA 2005-06-22 11:21:42 EDT
Verified in N20050622 using Boris' original steps.