public final class CommonViewerSorter extends TreePathViewerSorter
The CommonViewerSorter must be assigned a INavigatorContentService
to drive its sorting
algorithm. Without a vaild content service, the sorter will return the default ordering.
A CommonViewerSorter may not be attached to more than one CommonViewer.
Clients may not extend this class.
collator
Constructor and Description |
---|
CommonViewerSorter() |
Modifier and Type | Method and Description |
---|---|
int |
category(Object element)
Returns the category of the given element.
|
int |
compare(Viewer viewer,
TreePath parentPath,
Object e1,
Object e2)
Compare the givcen elements that will have the given parent
path when they are added to the viewer.
|
protected void |
setContentService(org.eclipse.ui.internal.navigator.NavigatorContentService aContentService)
Create a sorter service attached to the given content service.
|
category, isSorterProperty, sort
getCollator, getComparator
compare, isSorterProperty, sort
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)
ViewerComparator
The default implementation of this framework method returns
0
. Subclasses may reimplement this method to provide
non-trivial categorization.
category
in class ViewerComparator
element
- the elementpublic int compare(Viewer viewer, TreePath parentPath, Object e1, Object e2)
TreePathViewerSorter
null
when the elements are root elements.
By default, the this method calls
ViewerComparator.sort(Viewer, Object[])
. Subclasses may override.
compare
in class TreePathViewerSorter
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 positiveGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.