|
Re: Virtual tree viewer reinserts orphaned items [message #912034 is a reply to message #911750] |
Wed, 12 September 2012 20:38 |
Ivan Furnadjiev Messages: 2429 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Ken,
I've tested your code snippet in RCP it it behaves exactly the same like
in RAP. That's why I think that the problem is in the original JFace
code. You could prove this yourself and open a bug against JFace. What I
don't understand is why you refresh the element "2.1" when it is no
longer in the model?
Best,
Ivan
On 9/12/2012 11:51 AM, Ken Wenzel wrote:
> Hello,
>
> after the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=388950
> has been fixed - thank your for this - I discovered another one.
>
> The tree viewer starts with the following initial contents:
>
>
> Afterwards, this refresh logic is executed:
>
> parent2Children.put("2", new String[] { "2.2" });
> treeViewer.refresh("2");
> treeViewer.refresh("2.1"); // this accidentally reinserts "2.1" into the tree
>
>
> This leads to the following incorrect representation:
>
>
> Node "2" has child "2.1" instead of the correct child "2.2".
> The wrong behavior can be observed whether hash look-up is used or not.
>
> Certain breakpoints during debugging prevented the wrong behavior.
> Therefore, this may also be triggered by a race condition.
>
> I would be glad if you could help me.
>
> Best regards,
> Ken
>
>
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
|
Re: Virtual tree viewer reinserts orphaned items [message #912274 is a reply to message #912213] |
Thu, 13 September 2012 08:41 |
Ken Wenzel Messages: 51 Registered: July 2009 |
Member |
|
|
Hi Ivan,
I found a way to avoid this bug:
parent2Children.put("2", new String[] { "2.2" });
treeViewer.refresh("2");
// manually invoke tree.checkData() for the orphaned item
TreeItem item = (TreeItem) treeViewer.testFindItem("2.1");
if (item != null) {
// call getText to invoke tree.checkData()
item.getText();
}
treeViewer.refresh("2.1"); // now, this does not reinsert "2.1" into the tree
It seems that the tree should call checkData() at some point
when in VIRTUAL mode to correctly clean up the items.
The corresponding bugzilla entry is:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=389482
Best regards,
Ken
[Updated on: Thu, 13 September 2012 09:00] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01923 seconds