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 #870061] Sun, 06 May 2012 04:55
Charles Tubbs is currently offline Charles TubbsFriend
Messages: 35
Registered: March 2012
Member
I am having a problem setting a default selection in my createPartControl() function. I tried the following code :

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);
viewer.setExpandedState(selectedItem, false);
}

I followed the code in the debugger and saw that viewer.setSelection() alters a data item and fires an appropriate looking event, but nothing happens to the control. Similar code works in my addSelectionChangedListener(). It seems to be a timing problem.

Any clues?
Previous Topic:TreeViewer - set a default selection
Next Topic:TreeViewer - set a default selection
Goto Forum:
  


Current Time: Fri Dec 19 15:23:00 GMT 2014

Powered by FUDForum. Page generated in 0.01520 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software