Skip to main content



      Home
Home » Eclipse Projects » JFace » get element in treeviewer given treeitem
get element in treeviewer given treeitem [message #1028648] Thu, 28 March 2013 10:51 Go to next message
Eclipse UserFriend
Hi,

i have a multicolumn tree with a treeviewer. At some point i need to get the model object given a TreeItem. How can I do this? as it is easier with tableviewer using tableviewer.getElementAt(index). I think i have to use treeviewer.getVisibleExpandedElements() but how?

EDIT: and yes i select the leave node which is not retrieved by treeviewer#getVisibleExpandedElements() Sad. I need the model object of the selected leave node

appreciate any help.
Mok

[Updated on: Thu, 28 March 2013 11:24] by Moderator

Re: get element in treeviewer given treeitem [message #1028683 is a reply to message #1028648] Thu, 28 March 2013 11:55 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

one solution is to work with TreeSelection:
((TreeSelection) getViewer().getSelection());
(IStructuredSelection) getViewer().getSelection();
Re: get element in treeviewer given treeitem [message #1034739 is a reply to message #1028648] Fri, 05 April 2013 16:53 Go to previous message
Eclipse UserFriend
JFace sets the element as the un-named data object, so you can get the
element by simply calling the TreeItem:getData method.
Previous Topic:CoolBar on Windows does not works in Eclipse
Next Topic:Serializable DataBinding
Goto Forum:
  


Current Time: Wed Jul 23 07:25:36 EDT 2025

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

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

Back to the top