Package com.iizigo.navigator
Class ViewerComparator
java.lang.Object
org.eclipse.jface.viewers.ViewerComparator
org.eclipse.jface.viewers.ViewerSorter
com.iizigo.navigator.ViewerComparator
- All Implemented Interfaces:
- IViewerComparator
Class to sort nodes in a 
CommonViewerEx.- Author:
- Christopher Mindus
- Field Summary- Fields inherited from class org.eclipse.jface.viewers.ViewerSorter- collator
- Constructor SummaryConstructorsConstructorDescriptionCreates a new- ViewerComparator, which uses the default comparator to sort strings.
- Method SummaryModifier and TypeMethodDescription- intReturns the category of the given element.- intReturns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element.- booleanGet reverse ordering flag.- booleanGets sorting by category.- void- setReverseSortOrdering- (boolean on) Sets reverse ordering.- void- setSortByCategory- (boolean on) Sets sorting by category.- Methods inherited from class org.eclipse.jface.viewers.ViewerSorter- getCollator- Methods inherited from class org.eclipse.jface.viewers.ViewerComparator- getComparator, isSorterProperty, sort
- Constructor Details- ViewerComparatorpublic ViewerComparator()Creates a new- ViewerComparator, which uses the default comparator to sort strings.
 
- Method Details- setSortByCategorypublic void setSortByCategory- (boolean on) Sets sorting by category.
- getSortByCategorypublic boolean getSortByCategory()Gets sorting by category.
- setReverseSortOrderingpublic void setReverseSortOrdering- (boolean on) Sets reverse ordering.
- getReverseSortOrderingpublic boolean getReverseSortOrdering()Get reverse ordering flag.
- categoryReturns the category of the given element. The category is a number used to allocate elements to bins; the bins are arranged in ascending numeric order. The elements within a bin are arranged via a second level sort criterion.- Overrides:
- categoryin class- ViewerComparator
- Parameters:
- element- the element.
- Returns:
- the category.
 
- compareReturns a negative, zero, or positive number depending on whether the first element is less than, equal to, or greater than the second element.- Specified by:
- comparein interface- IViewerComparator
- Overrides:
- comparein 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 0if the first element is equal to the second element; and a positive number if the first element is greater than the second element.