Skip to main content



      Home
Home » Eclipse Projects » JFace » TreeViewer - set a default selection
TreeViewer - set a default selection [message #870065] Sun, 06 May 2012 00:55
Eclipse UserFriend
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: Mon Jul 07 20:54:36 EDT 2025

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

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

Back to the top