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

Bug 366385

Summary: [TableViewer] Deactivation of CellEditor resets selection
Product: [RT] RAP Reporter: Steffen Eichenberg <steffen.eichenberg>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan, ruediger.herrmann
Version: 1.4   
Target Milestone: 1.5 M5   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 366738    
Bug Blocks:    
Attachments:
Description Flags
Proposed fix none

Description Steffen Eichenberg CLA 2011-12-12 07:31:00 EST
Build Identifier: RAP 1.5M3

While a CellEditor is active and the selection changes because of TAB key events from one line to another, the table seems to track the selection changes. But when the CellEditor is deactivated (by ESC key or RET key), and then an ARROW UP or ARROW DOWN key is pressed, the selections seems to snap back to the line selected when activating a CellEditor.

Reproducible: Always

Steps to Reproduce:
1. Run RAP Controls Demo
2. Goto TableViewer tab
3. make table virtual, add 1000 lines, add CellEditors
4. activate CellEditor in fist row, first column
5. press TAB until you reach line 4
7. press ESC
8. press KEY DOWN.

Expected result: line 5 gets selected
Actual result: line 2 gets selected
Comment 1 Steffen Eichenberg CLA 2011-12-12 07:58:14 EST
Tested again without 'virtual'.
Problem exists only with 'virtual' tables.
Comment 2 Rüdiger Herrmann CLA 2011-12-13 08:26:23 EST
I cannot exactly reproduce the problem.
After deactivating the cell editor and pressing arrow-down, the 5th row is selected as expected as can be seen in the "Selection:" label on the right.
What doesn't work reliably though is the selection highlighting. Most times, the active cell is missing the bule background color.
Can you confirm that or am I missing anything?
Comment 3 Rüdiger Herrmann CLA 2011-12-13 11:28:59 EST
Opened bug 366575 for what is desribed in comment #2
Comment 4 Steffen Eichenberg CLA 2011-12-14 02:40:06 EST
I can reproduce the described bug with RAP 1.4.0 and RAP 1.5.0M3.

Today i downloaded a fresh copy of RAP 150M3, setup a new target platform in Eclipse, extracted the controls demo, started it with JDK 1.5 (Sun, Windows 7, 32 Bit), opened the controls Demo in FF 8.0 and made a short screencast of the effect.

You can find the screencast under the following address (valid for 7 days):

http://www.screencast-o-matic.com/watch/cXl2iUvGA


The bug manifests itself only with 'virtual' tables. Regular tables do not have that problem.
Comment 5 Ivan Furnadjiev CLA 2011-12-14 04:15:23 EST
I can reproduce what you describe with 1.5M3 but not with CVS HEAD. Could you give a latest nightly build a try (http://www.eclipse.org/rap/downloads/)? With migration of Table to the JSON protocol we changed (seems for good) the selection rendering. Probably, this fixes the issue.
Comment 6 Rüdiger Herrmann CLA 2011-12-14 18:39:37 EST
Created attachment 208417 [details]
Proposed fix

Changes virtualSetSelectionToWidget() so that it calls doSetSelection() when the 'reveal' parameter was set to true, otherwise it calls doDeselectAll() and doSelect()
For brevity of this patch, the now obsolete tracking of the 'firstItem' was not removed. This should be done in a final version.
Comment 7 Steffen Eichenberg CLA 2011-12-15 02:20:28 EST
@Ivan:

I have tested it with the NB Version of today (15.12.2011, rap-runtime-1.5.0-N-20111215-0213.zip). Problem still exists.
Comment 8 Ivan Furnadjiev CLA 2011-12-15 02:32:18 EST
(In reply to comment #7)
> @Ivan:
> 
> I have tested it with the NB Version of today (15.12.2011,
> rap-runtime-1.5.0-N-20111215-0213.zip). Problem still exists.
Yes... that's true. Yesterday we found that it worked with HEAD because of a not so correct code. I removed this code and now HEAD works the same with M3 and 1.4.1. The correct fix is outlined in the patch from comment #6.
Comment 9 Rüdiger Herrmann CLA 2011-12-15 05:43:10 EST
Applied patch from attachment 208417 [details] to Tree_Table_Merge branch
Comment 10 Rüdiger Herrmann CLA 2011-12-15 06:47:07 EST
Applied patch from attachment 208417 [details] to HEAD as an internediate solution until bug 366738 is resolved.