Package docking.widgets.search
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.
The FindDialog should use a single searcher for the life of the dialog. This allows all
search results generated by that dialog to share the same worker queue for running background
operations related to managing search results.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Disposes this searcher.The current cursor position.getEnd()The end cursor position.getStart()Returns the start cursor position.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.Search for all matches.
-
Method Details
-
getCursorPosition
CursorPosition getCursorPosition()The current cursor position. Used to search for the next item.- Returns:
- 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.
-
search
SearchResults 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 text is literal.- 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 text is literal.- Returns:
- all search results or an empty list.
-
dispose
void dispose()Disposes this searcher.
-