Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsTreeViewer - set a default selection
https://www.eclipse.org/forums/index.php/mv/msg/351105/870055/#msg_870055
I am trying to create a default selection in my tree viewer. I inserted the following code in my createPartControl() function :
menuModel = new BuildMenuModel();
viewer.setInput(menuModel);
if (selectedItem == null ) {
menuList = menuModel.getMenulevels();
selectedItem = menuList.get(0);
ISelection sel = new StructuredSelection(selectedItem);
viewer.setSelection(sel,true);
}
I have followed the code in the debugger and verified that setSelection sets a data item and fires an event but nothing happens. It probably has something to do with timing as similar code works works just fine in my addSelectionChangedListener().
Any clues?]]>Charles Tubbs2012-05-06T04:28:08-00:00