Virtual tree viewer reinserts orphaned items [message #911750] |
Wed, 12 September 2012 08:51  |
Eclipse User |
|
|
|
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
|
|
|
Re: Virtual tree viewer reinserts orphaned items [message #912034 is a reply to message #911750] |
Wed, 12 September 2012 20:38   |
Eclipse User |
|
|
|
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 #912207 is a reply to message #912034] |
Thu, 13 September 2012 06:20   |
Eclipse User |
|
|
|
Hi Ivan,
thank you for your help.
The element "2.1" is refreshed because at this point
I don't know if it is no longer in the model, or more precisely,
in our real application this decision would require to execute a
rather costly SPARQL query.
If I open a bug against JFace then how long will it take
to pull the potential fix into RAP?
Best regards,
Ken
|
|
|
Re: Virtual tree viewer reinserts orphaned items [message #912213 is a reply to message #912207] |
Thu, 13 September 2012 06:29   |
Eclipse User |
|
|
|
Hi Ken,
it depends on how fast the JFace team will fix the problem and will it
be an easy fix (couple lines of code) or a big one.
But please first open a bugzilla against JFace and wait for them to
confirm the problem.
Best,
Ivan
On 9/13/2012 9:20 AM, Ken Wenzel wrote:
> Hi Ivan,
>
> thank you for your help.
>
> The element "2.1" is refreshed because at this point I don't know if
> it is no longer in the model, or more precisely,
> in our real application this decision would require to execute a
> rather costly SPARQL query.
>
> If I open a bug against JFace then how long will it take
> to pull the potential fix into RAP?
>
> 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  |
Eclipse User |
|
|
|
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] by Moderator Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.09274 seconds