|
Eclipse Platform Release 3.2 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.jface.viewers.ViewerSorter
org.eclipse.ui.navigator.TreeViewerSorter
Provides context sensitive sorting of elements based on their parent in the tree.
Clients may extend this class.
EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/UI team.
| Field Summary |
|---|
| Fields inherited from class org.eclipse.jface.viewers.ViewerSorter |
|---|
collator |
| Constructor Summary | |
|---|---|
TreeViewerSorter()
|
|
| Method Summary | |
|---|---|
int |
compare(Viewer viewer,
Object parent,
Object e1,
Object e2)
Returns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element. |
void |
sort(Viewer viewer,
Object parent,
Object[] elements)
Sorts the given elements in-place taking into account the parent of the elements, modifying the given array. |
| Methods inherited from class org.eclipse.jface.viewers.ViewerSorter |
|---|
category, compare, getCollator, isSorterProperty, sort |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TreeViewerSorter()
| Method Detail |
public void sort(Viewer viewer,
Object parent,
Object[] elements)
The default implementation of this method uses the java.util.Arrays#sort
algorithm on the given array, calling compare to compare
elements, and the parent does not affect sorting algorithm.
Subclasses may reimplement this method to provide a more optimized implementation.
viewer - the viewerparent - The parent element in the tree of both children.elements - the elements to sort
public int compare(Viewer viewer,
Object parent,
Object e1,
Object e2)
The default implementation of this method is based on comparing the
elements' categories as computed by the category framework
method. Elements within the same category are further subjected to a case
insensitive compare of their label strings, either as computed by the
content viewer's label provider, or their toString values
in other cases. Subclasses may override.
viewer - the viewerparent - The parent element in the tree of both children.e1 - the first elemente2 - the second element
0 if the first element is equal
to the second element; and a positive number if the first element
is greater than the second element
|
Eclipse Platform Release 3.2 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.