Skip to main content



      Home
Home » Eclipse Projects » JFace » TreeViewer - set a default selection
TreeViewer - set a default selection [message #870067] Sun, 06 May 2012 00:55 Go to next message
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?
Re: TreeViewer - set a default selection [message #1401880 is a reply to message #870067] Wed, 16 July 2014 03:50 Go to previous message
Eclipse UserFriend
Hi Charles,

Are the menu levels presented in the treeviewer (do you display them in the treeviewer)?

Kind Regards,

Hussein
Previous Topic:TreeViewer - set a default selection
Next Topic:TreeViewer - set a default selection
Goto Forum:
  


Current Time: Thu Jul 17 03:10:45 EDT 2025

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

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

Back to the top