Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » select collapsed item in TreeView
select collapsed item in TreeView [message #831715] Thu, 29 March 2012 08:42 Go to next message
Lars Schütze is currently offline Lars Schütze
Messages: 12
Registered: March 2012
Junior Member
Hi community,

I want to select and expand a special path from a collapsed item in a SWT TreeView. If the tree is expanded thus far that the items are visible the code below works. Otherwise not.

TreeViewer mbViewer = (TreeViewer) mbSelectionProvider;
mbViewer.expandToLevel(linkTarget, 1);
mbViewer.setSelection(new StructuredSelection(linkTarget), true);
mbViewer.getTree().showSelection();


Does anyone have the trick to get this work?

I have to state that linkTarget is from Type EObject and is a different class as the TreeItem. Since I tried to calculate the TreePath myself I did'nt get this work as I did not know how I could compare the TreeItem's to the linkTarget's type.

Thanks in advance
Re: select collapsed item in TreeView [message #831799 is a reply to message #831715] Thu, 29 March 2012 11:18 Go to previous messageGo to next message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
Hi,
You could try asking this in the Eclipse JFace forum.


Lakshmi P Shanmugam
Re: select collapsed item in TreeView [message #834823 is a reply to message #831715] Mon, 02 April 2012 12:50 Go to previous message
Lars Schütze is currently offline Lars Schütze
Messages: 12
Registered: March 2012
Junior Member
Well, I decided to calculate the TreePath instead. This does the job. Thanks anyway.
Previous Topic:How to add toolbar to a CTabItem
Next Topic:How to change row layout structure based on radio button in Eclipse SWT
Goto Forum:
  


Current Time: Sat Oct 25 17:42:21 GMT 2014

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

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