Package docking.widgets

# Interface FindDialogSearcher

All Known Implementing Classes:
  `TextComponentSearcher`

public interface FindDialogSearcher
A simple interface for the `FindDialog` so that it can work for different search clients.

The `CursorPosition` object used by this interface is one that implementations can extend to add extra context to use when searching. The implementation is responsible for creating the locations and these locations will later be handed back to the searcher.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearHighlights()`
  Clears any active highlights.
  `default void`
  `dispose()`
  Disposes this searcher.
  `CursorPosition`
  `getCursorPosition()`
  The current cursor position.
  `CursorPosition`
  `getEnd()`
  The end cursor position.
  `CursorPosition`
  `getStart()`
  Returns the start cursor position.
  `void`
  `highlightSearchResults(SearchLocation location)`
  Called to signal the implementor should highlight the given search location.
  `SearchLocation`
  `search(String text, CursorPosition cursorPosition, boolean searchForward, boolean useRegex)`
  Perform a search for the next item in the given direction starting at the given cursor position.
  `default List<SearchLocation>`
  `searchAll(String text, boolean useRegex)`
  Search for all matches.
  `void`
  `setCursorPosition(CursorPosition position)`
  Sets the cursor position after a successful search.

- ## Method Details

  - ### getCursorPosition

    CursorPosition getCursorPosition()
    The current cursor position. Used to search for the next item.
    Returns:
      the cursor position.

  - ### setCursorPosition

    void setCursorPosition(CursorPosition position)
    Sets the cursor position after a successful search.
    Parameters:
      `position` - the cursor position.

  - ### getStart

    CursorPosition getStart()
    Returns the start cursor position. This is used when a search is wrapped to start at the beginning of the search range.
    Returns:
      the start position.

  - ### getEnd

    CursorPosition getEnd()
    The end cursor position. This is used when a search is wrapped while searching backwards to start at the end position.
    Returns:
      the end position.

  - ### highlightSearchResults

    void highlightSearchResults(SearchLocation location)
    Called to signal the implementor should highlight the given search location.
    Parameters:
      `location` - the search result location.

  - ### clearHighlights

    void clearHighlights()
    Clears any active highlights.

  - ### search

    SearchLocation search(String text, CursorPosition cursorPosition, boolean searchForward, boolean useRegex)
    Perform a search for the next item in the given direction starting at the given cursor position.
    Parameters:
      `text` - the search text.
      `cursorPosition` - the current cursor position.
      `searchForward` - true if searching forward.
      `useRegex` - true if the search text is a regular expression; false if the texts is literal text.
    Returns:
      the search result or null if no match was found.

  - ### searchAll

    default List<SearchLocation> searchAll(String text, boolean useRegex)
    Search for all matches.
    Parameters:
      `text` - the search text.
      `useRegex` - true if the search text is a regular expression; false if the texts is literal text.
    Returns:
      all search results or an empty list.

  - ### dispose

    default void dispose()
    Disposes this searcher. This does nothing by default.