Class PropertySheetSorter

java.lang.Object
org.eclipse.ui.views.properties.PropertySheetSorter

public class PropertySheetSorter extends Object
Class used by PropertySheetPage to sort properties.

The default implementation sorts alphabetically. Subclasses may overwrite to implement custom sorting.

Since:
3.1
  • Constructor Details

    • PropertySheetSorter

      public PropertySheetSorter()
      Creates a new sorter, which uses the default collator to sort strings.
    • PropertySheetSorter

      public PropertySheetSorter(Collator collator)
      Creates a new sorter, which uses the given collator to sort strings.
      Parameters:
      collator - the collator to use to sort strings
  • Method Details

    • compare

      public 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.

      The default implementation of this method uses the collator to compare the display names. Subclasses may override.

      Parameters:
      entryA - the first element
      entryB - 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

      public 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.

      The default implementation of this method uses the collator to compare the strings. Subclasses may override.

      Parameters:
      categoryA - the first element
      categoryB - 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

      protected Collator getCollator()
      Returns the collator used to sort strings.
      Returns:
      the collator used to sort strings
    • sort

      public void sort(IPropertySheetEntry[] entries)
      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