
Just change to implement ISelectionChangedListener to work on selection. A concrete tree-structured viewer based on an SWT Tree control with checkboxes on each node. Don't mess with the TreeItems, the viewer owns those and may change them at any time. Using StyledCellLabelProvider or one of its subclasses allows lots of styling choices. The key thing here is to use the selection as the argument to collapseToLevel / expandToLevel. Using TreeViewerColumn with separate label providers is probably the best way. llapseToLevel(sel, AbstractTreeViewer.ALL_LEVELS) ITreeContentProvider treeProvider = (ITreeContentProvider)provider If (provider instanceof ITreeContentProvider) IContentProvider provider = treeViewer.getContentProvider() JFace provides the viewers framework, which simplifies the mapping of a data model to a visual representation. TreeViewer treeViewer = (TreeViewer)event.getViewer()

Object sel = selection.getFirstElement() If (selection = null || selection.isEmpty()) Suppose you would like to set the background color of the header of the Price column in the treeview as shown below: Solution For those of you who have played with PHP-GTK2 for some time, you will know that setting the background of treeview header is not supported, yet.

touch file. If I start my program and do an expandAll() on the tree, then manually create a new file (in a seperate console window eg.

IStructuredSelection selection = (IStructuredSelection)event.getSelection() I have a simple directory/file list program that is displayed in a JFace treeview. This is what I use for double click: public class TreeDoubleClickListener implements void doubleClick(final DoubleClickEvent event) For a JFace TreeViewer you should use a ISelectionChangedListener or a IDoubleClickListener - do not use the underlying Tree listeners as they may not interact correctly with the viewer.
