Package docking.widgets
Interface FindDialogSearcher
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 TypeMethodDescriptionThe current cursor position.getEnd()
The end cursor position.getStart()
Returns the start cursor position.void
highlightSearchResults
(SearchLocation location) Called to signal the implementor should highlight the given search location.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> 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
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
Called to signal the implementor should highlight the given search location.- Parameters:
location
- the search result location.
-
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
- 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
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.
-