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

Bug 344551

Summary: [Viewers] ViewerComparator on Virtual Table breaks TableViewer#add()
Product: [Eclipse Project] Platform Reporter: Artur Kronenberg <artur.kronenberg>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, prakash
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug
Attachments:
Description Flags
Snippet for virtual table viewer with add and refresh button none

Description Artur Kronenberg CLA 2011-05-03 06:31:45 EDT
Created attachment 194561 [details]
Snippet for virtual table viewer with add and refresh button

Hi,

In my project I found that on add, a virtual table seems to break. It still adds elements to the table view, however it adds the wrong ones. 
this is a somewhat more detailed description (I'll attach code at the end) :

Create a table viewer that is virtual and add a comparator to it. Then add elements that would appear at the beginning of the Viewer. When calling add, the tableviewer adds a new element, but since it is adding it to the end, it retrieves the last element of the model. Due to the sorting of the model, the newly added element isn't at the end and the wrong element is added to the view.

This seems to be an indexing problem with the viewer. The correct element is created and calling refresh on the viewer will make everything appear in the right way. 

I used Tom's TableViewer sorter and changed the code so the UI has an add and a refresh method. Calling add will add elements that start with the index 1. The comparator will put them on top of the viewer and they won't be visible. After clicking refresh, everything works fine. 

Best regards,

-- artur
Comment 1 Eclipse Genie CLA 2019-10-10 13:35:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.