Package org.eclipse.jface.viewers
Interface ITreeSelection
- All Superinterfaces:
- ISelection,- IStructuredSelection,- Iterable
- All Known Implementing Classes:
- TreeSelection
A selection containing tree paths.
 
 It is recommended that clients do not implement this interface but instead
 use the standard implementation of this interface, TreeSelection.
 TreeSelection adds API for getting the IElementComparer
 of a selection (if available). This is important for clients who want to
 create a slightly modified tree selection based on an existing tree
 selection. The recommended coding pattern in this case is as follows:
 
 ITreeSelection selection = (ITreeSelection)treeViewer.getSelection();
 TreePath[] paths = selection.getPaths();
 IElementComparer comparer = null;
 if (selection instanceof TreeSelection) {
   comparer = ((TreeSelection)selection).getElementComparer();
 }
 TreePath[] modifiedPaths = ... // modify as required
 TreeSelection modifiedSelection = new TreeSelection(modifiedPaths, comparer);
 
 See bugs 135818 and 133375 for details.- Since:
- 3.2
- 
Method SummaryModifier and TypeMethodDescriptionTreePath[]getPaths()Returns the paths in this selectionTreePath[]getPathsFor(Object element) Returns the paths in this selection whose last segment is equal to the given elementMethods inherited from interface org.eclipse.jface.viewers.ISelectionisEmptyMethods inherited from interface org.eclipse.jface.viewers.IStructuredSelectiongetFirstElement, iterator, size, stream, toArray, toListMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Method Details- 
getPathsTreePath[] getPaths()Returns the paths in this selection- Returns:
- the paths in this selection
 
- 
getPathsForReturns the paths in this selection whose last segment is equal to the given element- Parameters:
- element- the element to get the tree paths for
- Returns:
- the array of tree paths
 
 
-