public class TreePathViewerSorter extends ViewerSorter
collator
Constructor and Description |
---|
TreePathViewerSorter() |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
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.
|
void |
sort(Viewer viewer,
TreePath parentPath,
Object[] elements)
Sorts the given elements in-place, modifying the given array.
|
getCollator
category, compare, getComparator, isSorterProperty, sort
public int category(TreePath parentPath, Object element)
null
when the elements are root elements.
By default, the this method calls
ViewerComparator.category(Object)
. Subclasses may override.
parentPath
- the parent path for the elementelement
- the elementpublic int compare(Viewer viewer, TreePath parentPath, Object e1, Object e2)
null
when the elements are root elements.
By default, the this method calls
ViewerComparator.sort(Viewer, Object[])
. Subclasses may override.
viewer
- the viewerparentPath
- the parent path for the two elementse1
- the first elemente2
- the second element0
if the first element is
equal to the second element; and a positivepublic boolean isSorterProperty(TreePath parentPath, Object element, String property)
null
when the elements are root elements.
The default implementation of this method calls
ViewerComparator.isSorterProperty(Object, String)
.
Subclasses may reimplement.
parentPath
- the parent path of the elementelement
- the elementproperty
- the propertytrue
if the sorting would be affected,
and false
if it would be unaffectedpublic void sort(Viewer viewer, TreePath parentPath, Object[] elements)
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 compare(Viewer, TreePath, Object, Object)
to compare elements.
Subclasses may reimplement this method to provide a more optimized implementation.
viewer
- the viewerparentPath
- the parent path of the given elementselements
- the elements to sort
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.