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

Bug 55485

Summary: [CellEditors] ICellModifier geting wrong call to modify method
Product: [Eclipse Project] Platform Reporter: Javier Latorre <eu_jls>
Component: UIAssignee: Tod Creasey <Tod_Creasey>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P4 CC: cnagy, ines
Version: 2.1.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 54989    
Bug Blocks:    

Description Javier Latorre CLA 2004-03-21 17:40:07 EST
I got a TableViewer component with several columns. I register an ICellModifier 
object, and create several cell editors. For two of the columns I use a 
ComboBoxCellEditor and a TextCellEditor. When I select de column the viewer 
shows correctly the combo control. Then I click the column of the TextEditor.

This works properly only if the call to the CellModifier::canModify returns 
true for the second column. If it returns false, I get a call to 
CellModifier::modify for the second column, but the value is the one of the 
first.

Lets see if I can explain, when I set the second column as editable, I get the 
next secuence of calls to ICellEditor
-getValue on Combo column (getting an Integer value)
-canModify on text column (now I return true)
-getValue on text column (getting an String value)
-modify on text column with value got in last call.(with the String value)

In case of canModify returning false
-getValue on Combo column (getting an Integer value)
-canModify on text column (now I return false)
-modify on text column with the Integer value got in the first call.

Thanks in advance
Comment 1 Ines Khelifi CLA 2004-04-07 15:21:43 EDT
Ok, so in my case, when I follow the steps that you indicated, 2 things can 
happen:
- If I select an item in the combo box, press the enter key, the combo box 
cell is deactivated. When I move on to the next cell to edit, everything 
behaves correctly.
- If I select an item in the combo box, without pressing the enter key, the 
combo box cell stays activated. When I move on to the next cell, I get the 
following exception:
java.lang.ClassCastException
	at com.opnworks.tableviewer.example.ExampleCellModifier.modify
(ExampleCellModifier.java:100) 

This is caused by some changes made in SWT for the WidgetSelect events (see 
bug# 54989). Before 3.0, the widgetDefaultSelected event would be thrown on 
mouse selection, and the cell editor would be disabled. After 3.0, SWT changes 
are causing behavioral problems for the TextCellEditor. Since the 
widgetDefaultSelected event is not thrown, the cell stays activated, and there 
is an attempt to modify the cell that should not be modified.
Comment 2 Ines Khelifi CLA 2004-04-14 15:21:14 EDT
I have vefiried this bug, and it is now fixed. I think the created patch for 
Bug# 34819 helped fix this one as well.
Comment 3 Tod Creasey CLA 2004-04-14 15:34:25 EDT

*** This bug has been marked as a duplicate of 34819 ***
Comment 4 Tod Creasey CLA 2004-04-14 15:41:35 EDT
*** Bug 55275 has been marked as a duplicate of this bug. ***