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

Bug 261647

Summary: [Viewer] Viewer selection not highlighted when set programmatically and CellEditors are active
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.2   
Target Milestone: 1.2 M5   
Hardware: All   
OS: All   
Whiteboard:

Description Ralf Sternberg CLA 2009-01-20 09:14:54 EST
A selection set via org.eclipse.jface.viewers.Viewer.setSelection(ISelection selection) is not highlighted on the client when CellEditors are active.
Obviously, the FocusCellOwnerDrawHighlighter is not notified when the selection changes programmatically.
Might be related to bug 241530.
Comment 1 Ralf Sternberg CLA 2009-01-30 05:58:29 EST
Fixed in CVS HEAD.

The original JFace code uses the SWT event EraseItem to colorize cells on selection (FocusCellOwnerDrawHighlighter).
This event is missing in RWT, so we tried to keep track of selection changes using some other RWT listeners. The problem is that we don't get notified for programmatic selection changes. MULTI selection makes it even worse.

The solution is to use a JFace SelectionChanged listener instead.
Comment 2 Ralf Sternberg CLA 2009-02-05 12:48:55 EST
Note that this fix caused a regression, reported in bug 262155, which could be fixed by further improvements in FocusCellOwnerDrawHighlighter.
Comment 3 Ralf Sternberg CLA 2011-10-10 16:16:03 EDT
After some more investigation, we found that in original SWT/JFace, the selection of TableViewers is *not* visualized when CellEditors are enabled. Only the focused cell is highlighted by the FocusCellHighlighter. Since for SINGLE selection mode, the focused cell is always part of the selected item, this difference is not obvious. But with MULTI selection, multiple items can be selected while only a single cell is actually highlighted.

It seems that JFace CellEditors have not been designed to work with MULTI.

This finding renders this bug and also my fix for it invalid, since the expected behavior is not implemented in SWT as well.