|
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
org.eclipse.ui.navigator.CommonViewerSorter
Provides an implementation of TreeViewerSorter that uses the given parent to determine the correct sort order based on the defined org.eclipse.ui.navigator.navigatorContent/navigatorContent/commonSorter elements available in the set of visible content extensions.
The CommonViewerSorter must be assigned to a CommonViewer. This is required
so that the sorter has the correct content service and sorting service available
to guide it in sorting the elements from the viewer. No guarantees are made
for uses of this sorter class outside of a CommonViewer.
A CommonViewerSorter may not be attached to more than one CommonViewer.
Clients may not 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 | |
|---|---|
CommonViewerSorter()
|
|
| Method Summary | |
|---|---|
int |
category(Object element)
Returns the category of the given element. |
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. |
protected void |
setContentService(org.eclipse.ui.internal.navigator.NavigatorContentService aContentService)
Create a sorter service attached to the given content service. |
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 |
|---|
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 CommonViewerSorter()
| Method Detail |
protected void setContentService(org.eclipse.ui.internal.navigator.NavigatorContentService aContentService)
aContentService - The content service used by the viewer that will use this
sorter service.public int category(Object element)
ViewerSorter
The default implementation of this framework method returns
0. Subclasses may reimplement this method to provide
non-trivial categorization.
category in class ViewerSorterelement - the element
public void sort(Viewer viewer,
Object parent,
Object[] elements)
TreeViewerSorter
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.
sort in class TreeViewerSorterviewer - 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)
TreeViewerSorter
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.
compare in class TreeViewerSorterviewer - 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.