Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Platform
Release 3.5

Interface ITreeSelection

All Superinterfaces:
ISelection, IStructuredSelection
All Known Implementing Classes:

public interface ITreeSelection
extends IStructuredSelection

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.


Method Summary
  TreePath[] getPaths ()
          Returns the paths in this selection
  TreePath[] getPathsFor ( Object element)
          Returns the paths in this selection whose last segment is equal to the given element
Methods inherited from interface org.eclipse.jface.viewers. IStructuredSelection
getFirstElement, iterator, size, toArray, toList
Methods inherited from interface org.eclipse.jface.viewers. ISelection

Method Detail


TreePath[] getPaths()
Returns the paths in this selection

the paths in this selection


TreePath[] getPathsFor(
Object element)
Returns the paths in this selection whose last segment is equal to the given element

element - the element to get the tree paths for
the array of tree paths

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire