TreeViewer setSelection does not work properly [message #652774] |
Sun, 06 February 2011 16:36 |
diwe Messages: 1 Registered: February 2011 |
Junior Member |
|
|
Hi all,
I have problems with treeViewer.setSelection method.
My domain model:
When a new component, e.g. "B", is added, the selection of the new component works fine with the following code:
treeViewer.refresh();
treeViewer.setSelection(newStructuredSelection(currentList.get(indexofA+1)), true);
Now I select A to add myList1 after A and execute the same code for the selection. Works fine.
The problem:
When a new myList2 is added after let's say myListX, the same code is executed:
reeViewer.refresh();
treeViewer.setSelection(newStructuredSelection(currentList.get(indexofMyListX+1)), true);
The selection is not at the desired position of myList2 (indexofMyListX+1), but on myList1.
When I add myList3 after myList2, then myList1 is selected again.
When I add myList4 before myList1, then myList4 is selected (as desired).
When I add myList5 after myList2, then myList4 is selected instead of myList5.
Do you have any advice?
Best Regards,
diwe
|
|
|
Powered by
FUDForum. Page generated in 0.03012 seconds