java - How to determine if a TreeItem is a leaf or not -


i have jface treeviewer wherein user can select treeitem , check whether ist leaf node or not through menu option.

how achieve this?

you can selected object tree viewer with:

istructuredselection selection = (istructuredselection)viewer.getselection();  object selected = selection.getfirstelement(); 

where 'viewer' treeviewer

selected model object returned content provider.

you can use content provider test if has children with:

itreecontentprovider provider = (itreecontentprovider)viewer.getcontentprovider();  boolean haschildren = provider.haschildren(selected); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -