Package org.eclipse.jface.viewers
Class TreeSelection
java.lang.Object
org.eclipse.jface.viewers.StructuredSelection
org.eclipse.jface.viewers.TreeSelection
- All Implemented Interfaces:
Iterable,ISelection,IStructuredSelection,ITreeSelection
A concrete implementation of the
ITreeSelection interface,
suitable for instantiating.
This class is not intended to be subclassed.
- Since:
- 3.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty selection.TreeSelection(TreePath treePath) Constructs a selection based on the elements identified by the given tree path.TreeSelection(TreePath[] paths) Constructs a selection based on the elements identified by the given tree paths.TreeSelection(TreePath[] paths, IElementComparer comparer) Constructs a selection based on the elements identified by the given tree paths.TreeSelection(TreePath treePath, IElementComparer comparer) Constructs a selection based on the elements identified by the given tree path. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this structured selection is equal to the given object.Returns the element comparer passed in when the tree selection has been created ornullif no comparer has been provided.TreePath[]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 class org.eclipse.jface.viewers.StructuredSelection
getFirstElement, hashCode, isEmpty, iterator, size, stream, toArray, toList, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jface.viewers.ISelection
isEmptyMethods inherited from interface org.eclipse.jface.viewers.IStructuredSelection
getFirstElement, iterator, size, stream, toArray, toListMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY
The canonical empty selection. This selection should be used instead ofnull.
-
-
Constructor Details
-
TreeSelection
Constructs a selection based on the elements identified by the given tree paths.- Parameters:
paths- tree paths
-
TreeSelection
Constructs a selection based on the elements identified by the given tree paths.- Parameters:
paths- tree pathscomparer- the comparer, ornullif default equals is to be used
-
TreeSelection
Constructs a selection based on the elements identified by the given tree path.- Parameters:
treePath- tree path, ornullfor an empty selection
-
TreeSelection
Constructs a selection based on the elements identified by the given tree path.- Parameters:
treePath- tree path, ornullfor an empty selectioncomparer- the comparer, ornullif default equals is to be used
-
TreeSelection
public TreeSelection()Creates a new empty selection. See also the static fieldEMPTYwhich contains an empty selection singleton.- See Also:
-
-
Method Details
-
getElementComparer
Returns the element comparer passed in when the tree selection has been created ornullif no comparer has been provided.- Returns:
- the element comparer or
null - Since:
- 3.2
-
equals
Description copied from class:StructuredSelectionReturns whether this structured selection is equal to the given object. Two structured selections are equal if they contain the same elements in the same order.- Overrides:
equalsin classStructuredSelection- Parameters:
obj- the other object- Returns:
trueif they are equal, andfalseotherwise
-
getPaths
Description copied from interface:ITreeSelectionReturns the paths in this selection- Specified by:
getPathsin interfaceITreeSelection- Returns:
- the paths in this selection
-
getPathsFor
Description copied from interface:ITreeSelectionReturns the paths in this selection whose last segment is equal to the given element- Specified by:
getPathsForin interfaceITreeSelection- Parameters:
element- the element to get the tree paths for- Returns:
- the array of tree paths
-