Class TableComparator

java.lang.Object
org.eclipse.jface.viewers.ViewerComparator
org.eclipse.ui.views.markers.internal.TableComparator
All Implemented Interfaces:
Comparator<TableComparator>

public class TableComparator extends ViewerComparator implements Comparator<TableComparator>
  • Field Details

    • MAX_DEPTH

      public static final int MAX_DEPTH
      See Also:
    • ASCENDING

      public static final int ASCENDING
      See Also:
    • DESCENDING

      public static final int DESCENDING
      See Also:
    • fields

      protected IField[] fields
    • priorities

      protected int[] priorities
    • directions

      protected int[] directions
    • defaultPriorities

      protected int[] defaultPriorities
    • defaultDirections

      protected int[] defaultDirections
    • TAG_DIALOG_SECTION

      public static final String TAG_DIALOG_SECTION
      See Also:
  • Constructor Details

    • TableComparator

      public TableComparator(TableComparator other)
    • TableComparator

      public TableComparator(IField[] properties, int[] defaultPriorities, int[] defaultDirections)
  • Method Details

    • resetState

      protected void resetState()
    • reverseTopPriority

      public void reverseTopPriority()
    • setTopPriority

      public void setTopPriority(IField property)
    • setTopPriority

      public void setTopPriority(int priority)
    • setTopPriorityDirection

      public void setTopPriorityDirection(int direction)
    • getTopPriorityDirection

      public int getTopPriorityDirection()
    • getTopPriority

      public int getTopPriority()
    • getTopField

      public IField getTopField()
      Return the field at the top priority.
      Returns:
      IField
    • getPriorities

      public int[] getPriorities()
    • getDirections

      public int[] getDirections()
    • getDefaultPriorities

      public int[] getDefaultPriorities()
    • getDefaultDirections

      public int[] getDefaultDirections()
    • compare

      public int compare(Viewer viewer, Object e1, Object e2)
      Description copied from class: ViewerComparator
      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 is based on comparing the elements' categories as computed by the category framework method. Elements within the same category are further subjected to a case insensitive compare of their label strings, either as computed by the content viewer's label provider, or their toString values in other cases. Subclasses may override.

      Overrides:
      compare in class ViewerComparator
      Parameters:
      viewer - the viewer
      e1 - the first element
      e2 - 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
    • compare

      protected int compare(Object obj1, Object obj2, int depth, boolean continueSearching)
      Compare obj1 and obj2 at depth. If continueSearching continue searching below depth to continue the comparison.
      Returns:
      int
    • getFields

      public IField[] getFields()
      Returns:
      IField[] an array of fields
    • compare

      public int compare(TableComparator o1, TableComparator o2)
      Specified by:
      compare in interface Comparator<TableComparator>
    • saveState

      public void saveState(IDialogSettings dialogSettings)
    • restoreState

      public void restoreState(IDialogSettings dialogSettings)
    • sort

      public void sort(Viewer viewer, Object[] elements, int start, int end)
      Sorts the given elements in-place, modifying the given array from index start to index end.