Package docking.widgets
Class TextComponentSearcher
java.lang.Object
docking.widgets.TextComponentSearcher
- All Implemented Interfaces:
FindDialogSearcher
A class to find text matches in the given
TextComponent. This class will search for all
matches and cache the results for future requests when the user presses Next or Previous. All
matches will be highlighted in the text component. The match containing the cursor will be a
different highlight color than the others. When the find dialog is closed, all highlights are
removed.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears any active highlights.voiddispose()Disposes this searcher.The current cursor position.getEnd()The end cursor position.getStart()Returns the start cursor position.booleanvoidhighlightSearchResults(SearchLocation location) Called to signal the implementor should highlight the given search location.booleanisStale()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.voidsetCursorPosition(CursorPosition position) Sets the cursor position after a successful search.voidsetEditorPane(JEditorPane editorPane) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface docking.widgets.FindDialogSearcher
searchAll
-
Constructor Details
-
TextComponentSearcher
-
-
Method Details
-
setEditorPane
-
getEditorPane
-
dispose
public void dispose()Description copied from interface:FindDialogSearcherDisposes this searcher. This does nothing by default.- Specified by:
disposein interfaceFindDialogSearcher
-
clearHighlights
public void clearHighlights()Description copied from interface:FindDialogSearcherClears any active highlights.- Specified by:
clearHighlightsin interfaceFindDialogSearcher
-
hasSearchResults
public boolean hasSearchResults() -
isStale
public boolean isStale() -
getCursorPosition
Description copied from interface:FindDialogSearcherThe current cursor position. Used to search for the next item.- Specified by:
getCursorPositionin interfaceFindDialogSearcher- Returns:
- the cursor position.
-
setCursorPosition
Description copied from interface:FindDialogSearcherSets the cursor position after a successful search.- Specified by:
setCursorPositionin interfaceFindDialogSearcher- Parameters:
position- the cursor position.
-
getStart
Description copied from interface:FindDialogSearcherReturns the start cursor position. This is used when a search is wrapped to start at the beginning of the search range.- Specified by:
getStartin interfaceFindDialogSearcher- Returns:
- the start position.
-
getEnd
Description copied from interface:FindDialogSearcherThe end cursor position. This is used when a search is wrapped while searching backwards to start at the end position.- Specified by:
getEndin interfaceFindDialogSearcher- Returns:
- the end position.
-
highlightSearchResults
Description copied from interface:FindDialogSearcherCalled to signal the implementor should highlight the given search location.- Specified by:
highlightSearchResultsin interfaceFindDialogSearcher- Parameters:
location- the search result location.
-
search
public SearchLocation search(String text, CursorPosition cursorPosition, boolean searchForward, boolean useRegex) Description copied from interface:FindDialogSearcherPerform a search for the next item in the given direction starting at the given cursor position.- Specified by:
searchin interfaceFindDialogSearcher- 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.
-