Package org.eclipse.ui.views.properties
Class PropertySheetSorter
java.lang.Object
org.eclipse.ui.views.properties.PropertySheetSorter
Class used by
PropertySheetPage
to
sort properties.
The default implementation sorts alphabetically. Subclasses may overwrite to implement custom sorting.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionCreates 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. -
Method Summary
Modifier and TypeMethodDescriptionint
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
Returns the collator used to sort strings.void
sort
(IPropertySheetEntry[] entries) Sorts the given elements in-place, modifying the given array.
-
Constructor Details
-
PropertySheetSorter
public PropertySheetSorter()Creates a new sorter, which uses the default collator to sort strings. -
PropertySheetSorter
Creates a new sorter, which uses the given collator to sort strings.- Parameters:
collator
- the collator to use to sort strings
-
-
Method Details
-
compare
Returns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element.The default implementation of this method uses the collator to compare the display names. Subclasses may override.
- Parameters:
entryA
- the first elemententryB
- the second element- Returns:
- a negative number if the first element is less than the second
element; the value
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
-
compareCategories
Returns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element.The default implementation of this method uses the collator to compare the strings. Subclasses may override.
- Parameters:
categoryA
- the first elementcategoryB
- the second element- Returns:
- a negative number if the first element is less than the second
element; the value
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
-
getCollator
Returns the collator used to sort strings.- Returns:
- the collator used to sort strings
-
sort
Sorts the given elements in-place, modifying the given array.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.
- Parameters:
entries
- the elements to sort
-