Bug 117165 - [Viewers] DeferredContentProvider doesn't update UI for changed elements
Summary: [Viewers] DeferredContentProvider doesn't update UI for changed elements
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 2000
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks: 509006
  Show dependency tree
 
Reported: 2005-11-18 18:14 EST by Jeff Magill CLA
Modified: 2019-11-28 14:51 EST (History)
0 users

See Also:


Attachments
testcase with a small application (3.47 KB, application/octet-stream)
2005-11-18 18:17 EST, Jeff Magill CLA
no flags Details
ConcurrentTableUpdator workaround (11.53 KB, text/plain)
2005-11-18 18:20 EST, Jeff Magill CLA
no flags Details
BackgroundContentProvider workaround (16.49 KB, text/plain)
2005-11-18 18:21 EST, Jeff Magill CLA
no flags Details
Testcase for larger sets of items and the sentObjects issue (4.48 KB, application/octet-stream)
2005-12-19 20:42 EST, Jeff Magill CLA
no flags Details
FIXME tag identifies suspicious code (10.81 KB, text/plain)
2005-12-19 20:46 EST, Jeff Magill CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Magill CLA 2005-11-18 18:14:46 EST
I first saw this bug in 3.1.1, but it appears in 3.2 and the latest build I
checked is 3.2 I20051116-1332.

It's an issue with supplying the TableViewer with a DeferredContentProvider.
When elements of the model are changed (that is, IConcurrentModelListener#update
is invoked to notify the provider of the changes), the Table is not updated
unless the results of the sort changes the order of the rows.  

What it comes down to is that when the SetModel#changeAll method is invoked, the
UI doesn't get updated some of the time.  

There appears to be an issue with the ConcurrentTableUpdator class where it
doesn't flush its pending clears unless it's told the element assigned to a row
is different (replace()) or checkVisibleRange() is invoked.  The
ConcurrentTableUpdator#scheduleUIUpdate method should be invoked when clears are
pending regardless of whether element-to-tablerow assignments change.

To reproduce the problem, construct a java project from the testcase attached
(updatorproblem).  After launching the application, you should see a table with
some content and some controls beside the table.

- select the first row in the table (should be "22 | Jitter")

- click the "Change to->" button which changes the integer value of the element
associated with the first row.  The table is not updated with the new integer
value.  (The table is sorted by the Text column so the sort order won't change.)

- click the "Change to->" button again.  In eclipse 3.1.1, the table remains
unchanged, but in eclipse 3.2., the table is now updated with the previous
integer value (0).  I believe that this is because the "Change to->" button
invokes a getSelection() which triggers the pending clear from the previous
update to be flushed to the table.  As you click the button successively, the
table will update but it is always behind a step.

The best workaround I've thought of so far is to use my own versions of
BackgroundContentProvider and ConcurrentTableUpdator.  I added a method to
ConcurrentTableUpdator that schedules the ui update when there are pending
clears and then I invoke that from BackgroundContentProvider#doSort after the
ConcurrentTableUpdator#replace invocations (that way, the method I added does
nothing if the replace() invocations flushed the pending clears).  I'll attach
my workarounds for your reference.
Comment 1 Jeff Magill CLA 2005-11-18 18:17:12 EST
Created attachment 30271 [details]
testcase with a small application

this is the testcase mentioned in the bug description
Comment 2 Jeff Magill CLA 2005-11-18 18:20:32 EST
Created attachment 30273 [details]
ConcurrentTableUpdator workaround

added the updateCleared method
Comment 3 Jeff Magill CLA 2005-11-18 18:21:27 EST
Created attachment 30274 [details]
BackgroundContentProvider workaround

the invocation of ConcurrentTableUpdator#updateCleared is in this file
Comment 4 Jeff Magill CLA 2005-12-19 20:36:47 EST
I found something else in the ConcurrentTableUpdator that seems to cause SetData to be ignored when the table should be updated.

The ConcurrenTableUpdator#replace() method references the sentObjects array to decide if it's already sent the table the new data.  However, there is a loop where it is using the wrong index into the sentObjects array.  I will create another attachment that illustrates this.  Search for the FIXME tag in the replace method.

I attached another testcase that helps in identifying this particular version of the update problem.

Run the testcase in the elements_not_updated attachment:

-  Click on the "Text" column header to sort by that column.

- Scroll down to item "text_5000" and select it.

- Hit the "Change to->" button over on the left side. 

Comment 5 Jeff Magill CLA 2005-12-19 20:42:01 EST
Created attachment 31992 [details]
Testcase for larger sets of items and the sentObjects issue
Comment 6 Jeff Magill CLA 2005-12-19 20:46:07 EST
Created attachment 31993 [details]
FIXME tag identifies suspicious code

The third FIXME tag is placed at the spot where I question the index usage.  The second FIXME tag is at the place where I think the pendingClears array is being resized improperly.
Comment 7 Boris Bokowski CLA 2009-11-26 09:48:56 EST
Hitesh is now responsible for watching bugs in the [Viewers] component area.
Comment 8 Eclipse Genie CLA 2019-11-28 14:51:47 EST
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.