public final class CommonViewerSorter extends TreePathViewerSorter
The CommonViewerSorter must be assigned a INavigatorContentService to drive its sorting
algorithm. Without a valid content service, the sorter will return the default ordering.
A CommonViewerSorter may not be attached to more than one CommonViewer.
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 given elements that will have the given parent
path when they are added to the viewer.
|
boolean |
isSorterProperty(Object element,
String property)
Returns whether this viewer sorter would be affected
by a change to the given property of the given element.
|
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 |
setContentService(INavigatorContentService aContentService)
Create a sorter service attached to the given content service.
|
category, sortgetCollatorcompare, getComparator, sortpublic void setContentService(INavigatorContentService 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 ViewerComparatorelement - the elementpublic int compare(Viewer viewer, TreePath parentPath, Object e1, Object e2)
TreePathViewerSorternull when the elements are root elements.
By default, the this method calls
ViewerComparator.sort(Viewer, Object[]). Subclasses may override.
compare in class TreePathViewerSorterviewer - 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(Object element, String property)
ViewerComparator
The default implementation of this method returns false.
Subclasses may reimplement.
isSorterProperty in class ViewerComparatorelement - the elementproperty - the propertytrue if the sorting would be affected,
and false if it would be unaffectedpublic boolean isSorterProperty(TreePath parentPath, Object element, String property)
TreePathViewerSorternull when the elements are root elements.
The default implementation of this method calls
ViewerComparator.isSorterProperty(Object, String).
Subclasses may reimplement.
isSorterProperty in class TreePathViewerSorterparentPath - the parent path of the elementelement - the elementproperty - the propertytrue if the sorting would be affected,
and false if it would be unaffected
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.