|TreeViewer collapses when calling refresh() [message #524884]
||Sat, 03 April 2010 13:36
Originally posted by: leopold.gerlinger.aon.at|
I'm working on an explorer-like window to allow my customer to edit
database items from our SWT client. The window has a TreeViewer on the
left and a editor window to the right. Everything works fine, except
when I call refresh() on the TreeViewer to update the visible items
(text and image depends on a status cache). In this case most of my
tree collapses and is not opened again.
This seems to be bound to the fact that I load the child items of the
tree from the database everytime the getChildren() method is called.
It seems like the TreeViewer compares the object id's and collapses if
it's not able to match it with the ones returned by the new
getChildren() call. I've also tried to implement the equals() method of
my root item class to compare against the primary key of the database
but this doesn't help (or I've done something wrong).
In an older implementation (having the whole DB tables cached) it worked
when I copied the items attributes (the ones from the recently fetched
from the DB) to the items already known by the TreeViewer to avoid
returning new item objects to the TreeViewer. So there either seems a
dependency on the object id's or the hashcode of the objects.
Any hints of how I could solve the problem?
Regards - Leo
P.S.: I know, a snippet would be fine, but then I'd have to deliver my
DB too - that's a bit too much ;-)
Powered by FUDForum
. Page generated in 0.01378 seconds