Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TreeViewer - set a default selection
TreeViewer - set a default selection [message #870064] Sun, 06 May 2012 00:28
Charles Tubbs is currently offline Charles Tubbs
Messages: 35
Registered: March 2012
Member
Hi All,

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?
Previous Topic:TreeViewer - set a default selection
Next Topic:TreeViewer - set a default selection
Goto Forum:
  


Current Time: Thu Apr 17 08:36:25 EDT 2014

Powered by FUDForum. Page generated in 0.01529 seconds