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

Bug 368023

Summary: After binding an TableRidget again, some data isn't showen or index errors occur.
Product: [RT] Riena Reporter: Sergei Jochim <sergei.jochim>
Component: ridgetAssignee: Thorsten Schenkel <thorsten.schenkel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: christian.campo, sergei.jochim
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Sergei Jochim CLA 2012-01-06 07:29:54 EST
In my case i created a new table with 3 columns and column formatters. After rebinding the table with 5 columns and column formatter with index > 3 an IndexOutOfBoundsException is thrown when the table with 5 columns is shown.
But after confirming all exceptions with "ok" the table is normally shown.

Maybe there is a problem with the TableViewer in this code in method bindUIControl:

// try to reuse the table viewer 
viewer = (AbstractTableViewer) control.getData(TABLE_VIEWER_DATA_KEY);
if ((viewer == null) || (viewer.getControl() != control)) {
        viewer = createTableViewer();
        control.setData(TABLE_VIEWER_DATA_KEY, viewer);
}

It seems, that the table viewer references some old data after reusing it.
Comment 1 Thorsten Schenkel CLA 2012-01-16 04:48:45 EST
Because of a windows bug the space of images (see java comment at the end of this comment) is still reserved after rebinding the TableRdiget and the SWT table.
This problem can be fixed by calling the method Table.removeAll during unbinding the UI control.

Comment in Table.setTableEmpty:
	   /*
		* Bug in Windows.  When LVM_SETIMAGELIST is used to remove the
		* image list by setting it to NULL, the item width and height
		* is not changed and space is reserved for icons despite the
		* fact that there are none.  The fix is to set the image list
		* to be very small before setting it to NULL.  This causes
		* Windows to reserve the smallest possible space when an image
		* list is removed.
		*/