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

Bug 344566

Summary: [Viewers] SelectionProvider on SWT.Virtual TableViewer propagets wrong value when items have been replaced
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: prakash
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug
Attachments:
Description Flags
Sample rpc to display print the current selection and replace an element. none

Description Artur Kronenberg CLA 2011-05-03 09:30:25 EDT
Created attachment 194577 [details]
Sample rpc to display print the current selection and replace an element.

Hi,

I am using a virtual TableViewer. During runtime of the program some elements are being changed by the user. These changes are made by getting the index of the element in my viewer and calling replace. I also manipulate the content provider to have the model synchronized with the view.

It seems however that the virtual manager does not refresh its cached elements when replacing. Debugging the SelectionProvider of the tableviewer shows that it is retrieving the wrong element from the virtual manager. 

Is there something I got wrong when using replace? I can't find a different way to replace the models except for calling setInput which would kill my performance. 

TableViewer#refresh() will fix the problem because the virtual manager is refreshing its cached elements. 

I think that this a bug since creating the viewer without the virtual flag will fix the problem. 

I created a sample off the RCP with a view example to demonstrate. I register a listener to the selectionService of the workbench and print out the selection. A button is replacing the second element. When clicking on it again you'll see that the selection is retrieving the wrong element. (see attachment)

kind regards,

-- artur
Comment 1 Eclipse Genie CLA 2020-07-18 13:42:06 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.