public class PropertySheetSorter extends Object
PropertySheetPage
to
sort properties.
The default implementation sorts alphabetically. Subclasses may overwrite to implement custom sorting.
Constructor and Description |
---|
PropertySheetSorter()
Creates a new sorter, which uses the default collator to sort strings.
|
PropertySheetSorter(Collator collator)
Creates a new sorter, which uses the given collator to sort strings.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(IPropertySheetEntry entryA,
IPropertySheetEntry entryB)
Returns a negative, zero, or positive number depending on whether the
first element is less than, equal to, or greater than the second element.
|
int |
compareCategories(String categoryA,
String categoryB)
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 Collator |
getCollator()
Returns the collator used to sort strings.
|
void |
sort(IPropertySheetEntry[] entries)
Sorts the given elements in-place, modifying the given array.
|
public PropertySheetSorter()
public PropertySheetSorter(Collator collator)
collator
- the collator to use to sort stringspublic int compare(IPropertySheetEntry entryA, IPropertySheetEntry entryB)
The default implementation of this method uses the collator to compare the display names. Subclasses may override.
entryA
- the first elemententryB
- the second element0
if the first element is equal
to the second element; and a positive number if the first element
is greater than the second elementpublic int compareCategories(String categoryA, String categoryB)
The default implementation of this method uses the collator to compare the strings. Subclasses may override.
categoryA
- the first elementcategoryB
- the second element0
if the first element is equal
to the second element; and a positive number if the first element
is greater than the second elementprotected Collator getCollator()
public void sort(IPropertySheetEntry[] entries)
The default implementation of this method uses the java.util.Arrays#sort
algorithm on the given array, calling compare
to compare
elements.
Subclasses may reimplement this method to provide a more optimized implementation.
entries
- the elements to sort
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.