| Set Selection on Tree Viewer [message #644089] |
Thu, 09 December 2010 07:45  |
Aravindhan Annamalai Messages: 88 Registered: July 2009 Location: Chennai |
Member |
|
|
Hi,
We display a tree viewer, in which we need to select a particular node by default.
The tree when displayed shows only the root node.
We tried using tree paths by,
we constructed the tree path, using createChildPath and got a successfull tree path and used the below methods...
thisTreeViewer.setExpandedState(prevPath, true); --> wasn't working
thisTreeViewer.setExpandedTreePaths(prevPath); --> wasn't working
thisTreeViewer.reveal(prevPath); ---> wasn't working
we tried
StructuredSelection structuredSelections = new StructuredSelection(selectionArray);
thisTreeViewer.setSelection(structuredSelections, true);
which was also not working in our case..
Is there something we are missing here...
only thisTreeViewer.expandAll() is working...
Regards,
Aravind
|
|
|
|
| Re: Set Selection on Tree Viewer [message #644107 is a reply to message #644089] |
Thu, 09 December 2010 09:33  |
Daniel Krügler Messages: 853 Registered: July 2009 |
Senior Member |
|
|
On 2010-12-09 13:45, Aravindhan.A wrote:
> Hi,
>
> We display a tree viewer, in which we need to select a particular node
> by default.
>
> The tree when displayed shows only the root node.
>
> we tried
>
> StructuredSelection structuredSelections = new
> StructuredSelection(selectionArray);
> thisTreeViewer.setSelection(structuredSelections, true);
>
> which was also not working in our case..
This should work. I assume you did not provide equal items when
constructing the selection object. This can happen, if your objects
types don't override equal/hash correctly. You can make your tree
equality-aware without need to modify your types, if you provide an
IElementComparer to the tree (I think you need to activate useHashLookup
to make that work).
HTH & Greetings from Bremen,
Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.01426 seconds