Skip to main content


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 #870067] Sun, 06 May 2012 04:55 Go to next message
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?
Re: TreeViewer - set a default selection [message #1401880 is a reply to message #870067] Wed, 16 July 2014 07:50 Go to previous message
Hussein MHANNA is currently offline Hussein MHANNAFriend
Messages: 45
Registered: February 2014
Location: LAVAL
Member
Hi Charles,

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

Kind Regards,

Hussein


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


Current Time: Fri Mar 29 09:22:52 GMT 2024

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

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

Back to the top