@Deprecated public final class FindHighlightPlugin extends java.lang.Object implements EditorPlugin, javax.swing.event.DocumentListener
FindHighlightPlugin
provides support for finding
and highlighting occurrences of text. Highlights are added to the
editor pane for the given search text, and maintained across document
modifications until the next find is issued, or until clients
clear them explicitly.
To use this plugin, install it into the editor pane by calling
on the installPlugin()
BasicEditorPane
. Once it is installed, you can
use the plugin by just calling
with the appropriate parameters. findText()
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PLUGIN_PROPERTY
Deprecated.
Property name that we used for the plugin associated with the
editor pane used for the find highlighting.
|
Constructor and Description |
---|
FindHighlightPlugin()
Deprecated.
Constructs a new
FindHighlightPlugin that is not
currently associated with any editor or document. |
Modifier and Type | Method and Description |
---|---|
void |
changedUpdate(javax.swing.event.DocumentEvent event)
Deprecated.
Gives notification that an attribute or set of attributes changed.
|
void |
clearFindHighlighting()
Deprecated.
Clears the results of a previous find highlighting request.
|
void |
deinstall(BasicEditorPane editor)
Deprecated.
Called when the plugin is being removed from the BasicEditorPane
(for example when the editor is closed.) This is used to notify
plugins that they should unregister any listeners that were
attached.
|
int |
findText(java.lang.String searchText,
int startOffset,
boolean searchForward,
boolean matchCase,
boolean wrapAround,
boolean highlightOccurrences)
Deprecated.
This is the public entrypoint for users of this plugin for the find
operation.
|
int |
findText(java.lang.String searchText,
int startOffset,
boolean searchForward,
boolean matchCase,
boolean wrapAround,
boolean wholeWordOnly,
boolean highlightOccurrences)
Deprecated.
This is the public entrypoint for users of this plugin for the find
operation.
|
static HighlightStyle |
getFindHighlightStyle()
Deprecated.
|
boolean |
getFirstHighlightAfter(int position,
int[] range)
Deprecated.
|
boolean |
getFirstHighlightBefore(int position,
int[] range)
Deprecated.
|
boolean |
hasFindHighlighting()
Deprecated.
Fetches whether there is an active find highlighting enabled.
|
void |
insertUpdate(javax.swing.event.DocumentEvent event)
Deprecated.
Gives notification that there was an insert into the document.
|
void |
install(BasicEditorPane editor)
Deprecated.
Called when this plugin is being installed into the BasicEditorPane.
|
void |
propertyChange(java.beans.PropertyChangeEvent event)
Deprecated.
This method gets called when a bound property is changed.
|
void |
removeUpdate(javax.swing.event.DocumentEvent event)
Deprecated.
Gives notification that a portion of the document has been
removed.
|
public static final java.lang.String PLUGIN_PROPERTY
public FindHighlightPlugin()
FindHighlightPlugin
that is not
currently associated with any editor or document.public static HighlightStyle getFindHighlightStyle()
public void install(BasicEditorPane editor)
install
in interface EditorPlugin
editor
- the editor panepublic void deinstall(BasicEditorPane editor)
deinstall
in interface EditorPlugin
editor
- the editor panepublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- A PropertyChangeEvent object describing the event source
and the property that has changed.public void insertUpdate(javax.swing.event.DocumentEvent event)
insertUpdate
in interface javax.swing.event.DocumentListener
event
- the document eventpublic void removeUpdate(javax.swing.event.DocumentEvent event)
removeUpdate
in interface javax.swing.event.DocumentListener
event
- the document eventpublic void changedUpdate(javax.swing.event.DocumentEvent event)
changedUpdate
in interface javax.swing.event.DocumentListener
event
- the document eventpublic int findText(java.lang.String searchText, int startOffset, boolean searchForward, boolean matchCase, boolean wrapAround, boolean highlightOccurrences)
searchText
- the search text to findstartOffset
- the starting location to do the searchsearchForward
- whether to search forwardmatchCase
- whether to match case, true to perform
case-sensitive matcheswrapAround
- whether to wrap-around to the beginning of
the document in case the search text was not found,
true to wrap aroundhighlightOccurrences
- whether to enable occurrence highlighting,
true to enable highlightingpublic int findText(java.lang.String searchText, int startOffset, boolean searchForward, boolean matchCase, boolean wrapAround, boolean wholeWordOnly, boolean highlightOccurrences)
searchText
- the search text to findstartOffset
- the starting location to do the searchsearchForward
- whether to search forwardmatchCase
- whether to match case, true to perform
case-sensitive matcheswrapAround
- whether to wrap-around to the beginning of
the document in case the search text was not found,
true to wrap aroundwholeWordOnly
- whether to check for whole-word occurrences only,
true to check for whole word onlyhighlightOccurrences
- whether to enable occurrence highlighting,
true to enable highlightingpublic void clearFindHighlighting()
public boolean hasFindHighlighting()
public boolean getFirstHighlightAfter(int position, int[] range)
public boolean getFirstHighlightBefore(int position, int[] range)