java - Children of Parent in JFace TreeViewer -


how retrieve children of selected item in jface treeviewer? able parent of selected item, not children.

you use tree content provider both children , parent of selection in tree viewer.

istructuredselection sel = treeviewer.getstructuredselection();  object selelement = sel.getfirstelement();  itreecontentprovider provider = (itreecontentprovider)treeviewer.getcontentprovider();  object [] children = provider.getchildren(selelement);  object parent = provider.getparent(selelement); 

note: when using treeviewer should avoid looking @ tree or treeitem controls treeviewer uses internally.


Comments

Popular posts from this blog

ruby on rails - ActiveRecord order not working -

javascript - How do you prevent nested queries/catches in sequelize? -

java - ConcurrentModificationException upon committing transaction with Hibernate -