public class SearchContext
extends java.lang.Object
implements java.lang.Cloneable
SearchEngine
methods to do the actual searching.SearchEngine
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
PROPERTY_MARK_ALL
Fired when the user toggles the "Mark All" property.
|
static java.lang.String |
PROPERTY_MATCH_CASE
Fired when the "match case" property is toggled.
|
static java.lang.String |
PROPERTY_MATCH_WHOLE_WORD
Fired when the "whole word" property is toggled.
|
static java.lang.String |
PROPERTY_REPLACE_WITH
Fired when the "replace with" property is modified.
|
static java.lang.String |
PROPERTY_SEARCH_FOR
Fired when the "search for" property is modified.
|
static java.lang.String |
PROPERTY_SEARCH_FORWARD
Fired when search direction is toggled.
|
static java.lang.String |
PROPERTY_SELECTION_ONLY
Fired when "search in selection" is toggled (not currently supported).
|
static java.lang.String |
PROPERTY_USE_REGEX
Fired when "use regular expressions" is toggled.
|
构造器和说明 |
---|
SearchContext()
Creates a new search context.
|
SearchContext(java.lang.String searchFor)
Creates a new search context.
|
SearchContext(java.lang.String searchFor,
boolean matchCase)
Creates a new search context.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener to this context.
|
SearchContext |
clone() |
protected void |
firePropertyChange(java.lang.String property,
boolean oldValue,
boolean newValue) |
protected void |
firePropertyChange(java.lang.String property,
java.lang.String oldValue,
java.lang.String newValue) |
boolean |
getMarkAll()
Returns whether "mark all" should be selected or enabled.
|
boolean |
getMatchCase()
Returns whether case should be honored while searching.
|
java.lang.String |
getReplaceWith()
Returns the text to replace with, if doing a replace operation.
|
java.lang.String |
getSearchFor()
Returns the text to search for.
|
boolean |
getSearchForward()
Returns whether the search should be forward through the text (vs.
|
boolean |
getSearchSelectionOnly()
Returns whether the search should only be done in the selected text.
|
boolean |
getWholeWord()
Returns whether only "whole word" matches should be returned.
|
boolean |
isRegularExpression()
Returns whether a regular expression search should be done.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener from this context.
|
void |
setMarkAll(boolean markAll)
Sets whether "mark all" should be selected or enabled.
|
void |
setMatchCase(boolean matchCase)
Sets whether case should be honored while searching.
|
void |
setRegularExpression(boolean regex)
Sets whether a regular expression search should be done.This method
fires a property change event of type
PROPERTY_USE_REGEX |
void |
setReplaceWith(java.lang.String replaceWith)
Sets the text to replace with, if doing a replace operation.
|
void |
setSearchFor(java.lang.String searchFor)
Sets the text to search for.
|
void |
setSearchForward(boolean forward)
Sets whether the search should be forward through the text (vs.
|
void |
setSearchSelectionOnly(boolean selectionOnly)
Sets whether only the selected text should be searched.
|
void |
setWholeWord(boolean wholeWord)
Sets whether only "whole word" matches should be returned.
|
java.lang.String |
toString() |
public static final java.lang.String PROPERTY_SEARCH_FOR
public static final java.lang.String PROPERTY_REPLACE_WITH
public static final java.lang.String PROPERTY_MATCH_CASE
public static final java.lang.String PROPERTY_MATCH_WHOLE_WORD
public static final java.lang.String PROPERTY_SEARCH_FORWARD
public static final java.lang.String PROPERTY_SELECTION_ONLY
public static final java.lang.String PROPERTY_USE_REGEX
public static final java.lang.String PROPERTY_MARK_ALL
public SearchContext()
public SearchContext(java.lang.String searchFor)
searchFor
- The text to search for.public SearchContext(java.lang.String searchFor, boolean matchCase)
searchFor
- The text to search for.matchCase
- Whether to do a case-sensitive search.public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
l
- The new listener.removePropertyChangeListener(PropertyChangeListener)
public SearchContext clone()
clone
在类中 java.lang.Object
protected void firePropertyChange(java.lang.String property, boolean oldValue, boolean newValue)
protected void firePropertyChange(java.lang.String property, java.lang.String oldValue, java.lang.String newValue)
public boolean getMarkAll()
setMarkAll(boolean)
public boolean getMatchCase()
setMatchCase(boolean)
public java.lang.String getReplaceWith()
setReplaceWith(String)
,
getSearchFor()
public java.lang.String getSearchFor()
setSearchFor(String)
,
getReplaceWith()
public boolean getSearchForward()
setSearchForward(boolean)
public boolean getSearchSelectionOnly()
setSearchSelectionOnly(boolean)
public boolean getWholeWord()
setWholeWord(boolean)
public boolean isRegularExpression()
setRegularExpression(boolean)
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
l
- The listener to remove.addPropertyChangeListener(PropertyChangeListener)
public void setMarkAll(boolean markAll)
PROPERTY_MARK_ALL
.markAll
- Whether "mark all" should be enabled.getMarkAll()
public void setMatchCase(boolean matchCase)
PROPERTY_MATCH_CASE
.matchCase
- Whether case should be honored.getMatchCase()
public void setRegularExpression(boolean regex)
PROPERTY_USE_REGEX
regex
- Whether a regular expression search should be done.isRegularExpression()
public void setReplaceWith(java.lang.String replaceWith)
PROPERTY_REPLACE_WITH
.replaceWith
- The text to replace with.getReplaceWith()
,
setSearchFor(String)
public void setSearchFor(java.lang.String searchFor)
PROPERTY_SEARCH_FOR
.searchFor
- The text to search for.getSearchFor()
,
setReplaceWith(String)
public void setSearchForward(boolean forward)
PROPERTY_SEARCH_FORWARD
.forward
- Whether we should search forwards.getSearchForward()
public void setSearchSelectionOnly(boolean selectionOnly)
PROPERTY_SELECTION_ONLY
.
This flag is currently not supported.selectionOnly
- Whether only selected text should be searched.getSearchSelectionOnly()
public void setWholeWord(boolean wholeWord)
PROPERTY_MATCH_WHOLE_WORD
.wholeWord
- Whether only "whole word" matches should be returned.getWholeWord()
public java.lang.String toString()
toString
在类中 java.lang.Object