# Interface INavigatorSorterService

public interface INavigatorSorterService
Provides an interface to extensions declared in org.eclipse.ui.navigator.navigatorContent/commonSorter.

Like other extensions to the Common Navigator framework, sorters defined by the above extension point must be bound to the associated `INavigatorContentService` through a org.eclipse.ui.navigator.viewer/viewerContentBinding extension.

Since:
  3.2
See Also:
  - `INavigatorContentService.getSorterService()`
  - `ViewerComparator`
Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

## Method Summary

Modifier and Type
Method
Description
`Map<String, ViewerComparator>`
`findAvailableSorters(INavigatorContentDescriptor theSource)`
Find and return all viewer sorters associated with the given descriptor.
`ViewerComparator`
`findComparator(INavigatorContentDescriptor source, Object parent, Object lvalue, Object rvalue)`
Return a `ViewerComparator` from an extension which is visible to the associated `INavigatorContentService` and whose parentExpression matches the given parent.
`ViewerComparator`
`findComparatorForParent(Object aParent)`
Return a `ViewerComparator` from an extension which is visible to the associated `INavigatorContentService` and whose parentExpression matches the given parent.
`ViewerSorter`
`findSorter(INavigatorContentDescriptor source, Object parent, Object lvalue, Object rvalue)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `findComparator(INavigatorContentDescriptor, Object, Object, Object)` instead.
`ViewerSorter`
`findSorterForParent(Object aParent)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `findComparatorForParent(Object)` instead

## Method Details

### findSorterForParent

@Deprecated(since="2025-03", forRemoval=true) ViewerSorter findSorterForParent(Object aParent)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `findComparatorForParent(Object)` instead
Return a `ViewerSorter` from an extension which is visible to the associated `INavigatorContentService` and whose parentExpression matches the given parent.

Parameters:
  `aParent` - An element from the tree
Returns:
  An applicable ViewerSorter or simple `ViewerSorter` if no sorter is found.

### findComparatorForParent

ViewerComparator findComparatorForParent(Object aParent)
Return a `ViewerComparator` from an extension which is visible to the associated `INavigatorContentService` and whose parentExpression matches the given parent.

Parameters:
  `aParent` - An element from the tree
Returns:
  An applicable ViewerComparator or simple `ViewerComparator` if no sorter is found.
Since:
  3.13

### findSorter

@Deprecated(since="2025-03", forRemoval=true) ViewerSorter findSorter(INavigatorContentDescriptor source, Object parent, Object lvalue, Object rvalue)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `findComparator(INavigatorContentDescriptor, Object, Object, Object)` instead.
Return a `ViewerSorter` from an extension which is visible to the associated `INavigatorContentService` and whose parentExpression matches the given parent.

Parameters:
  `source` - The source of the element.
  `parent` - An element from the tree
  `lvalue` - An element from the tree
  `rvalue` - An element from the tree
Returns:
  An applicable ViewerSorter or simple `ViewerSorter` if no sorter is found.

### findComparator

ViewerComparator findComparator(INavigatorContentDescriptor source, Object parent, Object lvalue, Object rvalue)
Return a `ViewerComparator` from an extension which is visible to the associated `INavigatorContentService` and whose parentExpression matches the given parent.

Parameters:
  `source` - The source of the element.
  `parent` - An element from the tree
  `lvalue` - An element from the tree
  `rvalue` - An element from the tree
Returns:
  An applicable ViewerComparator or simple `ViewerComparator` if no sorter is found.
Since:
  3.13

### findAvailableSorters

Map<String, ViewerComparator> findAvailableSorters(INavigatorContentDescriptor theSource)
Find and return all viewer sorters associated with the given descriptor.

The commonSorter element is not required to have an id, so in some cases, an auto-generated id, using the content extension id as a base, is generated to ensure the map is properly filled with all available sorters. No guarantees are given as to the order or consistency of these generated ids between invocations.

Parameters:
  `theSource` - A descriptor that identifies a particular content extension
Returns:
  A Map[String sorterDescriptorId, ViewerComparator instance] where the key is the id defined in the extension and the value is the instantiated sorter.
Since:
  3.3
See Also:
  - `INavigatorContentService.getContentDescriptorById(String)`
  - `INavigatorContentService.getContentExtensionById(String)`
  - `INavigatorContentExtension.getDescriptor()`