| java.lang.Object org.eclipse.jface.viewers.ViewerComparator org.eclipse.jface.viewers.ViewerSorter org.eclipse.jface.viewers.TreePathViewerSorter
TreePathViewerSorter | public class TreePathViewerSorter extends ViewerSorter (Code) | | A viewer sorter that is provided extra context in the form of the path of the
parent element of the elements being sorted.
since: 3.2 |
Method Summary | |
public int | category(TreePath parentPath, Object element) Provide a category for the given element that will have the given parent
path when it is added to the viewer. | public int | compare(Viewer viewer, TreePath parentPath, Object e1, Object e2) Compare the given elements that will have the given parent
path when they are added to the viewer. | public boolean | isSorterProperty(TreePath parentPath, Object element, String property) Returns whether this viewer sorter would be affected
by a change to the given property of the given element.
The provided path is
relative to the viewer input. | public void | sort(Viewer viewer, TreePath parentPath, Object[] elements) Sorts the given elements in-place, modifying the given array.
The provided path is
relative to the viewer input. |
category | public int category(TreePath parentPath, Object element)(Code) | | Provide a category for the given element that will have the given parent
path when it is added to the viewer. The provided path is
relative to the viewer input. The parent path will
be null when the elements are root elements.
By default, the this method calls
ViewerSorter.category(Object) . Subclasses may override.
Parameters: parentPath - the parent path for the element Parameters: element - the element the category of the element |
compare | public int compare(Viewer viewer, TreePath parentPath, Object e1, Object e2)(Code) | | Compare the given elements that will have the given parent
path when they are added to the viewer. The provided path is
relative to the viewer input. The parent path will
be null when the elements are root elements.
By default, the this method calls
ViewerSorter.sort(ViewerObject[]) . Subclasses may override.
Parameters: viewer - the viewer Parameters: parentPath - the parent path for the two elements Parameters: e1 - the first element Parameters: e2 - the second element a negative number if the first element is less than the second element; the value 0 if the first element isequal to the second element; and a positive |
isSorterProperty | public boolean isSorterProperty(TreePath parentPath, Object element, String property)(Code) | | Returns whether this viewer sorter would be affected
by a change to the given property of the given element.
The provided path is
relative to the viewer input. The parent path will
be null when the elements are root elements.
The default implementation of this method calls
ViewerSorter.isSorterProperty(ObjectString) .
Subclasses may reimplement.
Parameters: parentPath - the parent path of the element Parameters: element - the element Parameters: property - the property true if the sorting would be affected,and false if it would be unaffected |
sort | public void sort(Viewer viewer, TreePath parentPath, Object[] elements)(Code) | | Sorts the given elements in-place, modifying the given array.
The provided path is
relative to the viewer input. The parent path will
be null when the elements are root elements.
The default implementation of this method uses the
java.util.Arrays#sort algorithm on the given array,
calling
TreePathViewerSorter.compare(Viewer,TreePath,Object,Object) to compare elements.
Subclasses may reimplement this method to provide a more optimized implementation.
Parameters: viewer - the viewer Parameters: parentPath - the parent path of the given elements Parameters: elements - the elements to sort |
|
|