|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gjt.sp.jedit.search.SearchAndReplace
public class SearchAndReplace
Class that implements regular expression and literal search within jEdit buffers.
There are two main groups of methods in this class:
jEdit.setBooleanProperty("search.hypersearch.toggle",true);
jEdit.setBooleanProperty("search.keepDialog.toggle",true);
If you are not using the dialog to undertake a search or replace, you may
call any of the search and replace methods (including
hyperSearch(View)) without concern for the value of these
properties.
| Constructor Summary | |
|---|---|
SearchAndReplace()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
escapeRegexp(java.lang.String str,
boolean multiline)
Escapes characters with special meaning in a regexp. |
static boolean |
find(View view)
Finds the next occurance of the search string. |
static boolean |
find(View view,
Buffer buffer,
int start)
Finds the next instance of the search string in the specified buffer. |
static boolean |
find(View view,
Buffer buffer,
int start,
boolean firstTime,
boolean reverse)
Finds the next instance of the search string in the specified buffer. |
static boolean |
getAutoWrapAround()
Returns the state of the auto wrap around flag. |
static boolean |
getBeanShellReplace()
Returns the state of the BeanShell replace flag. |
static boolean |
getIgnoreCase()
Returns the state of the ignore case flag. |
static boolean |
getRegexp()
Returns the state of the regular expression flag. |
static java.lang.String |
getReplaceString()
Returns the current replacement string. |
static boolean |
getReverseSearch()
Returns the state of the reverse search flag. |
static SearchFileSet |
getSearchFileSet()
Returns the current search file set. |
static SearchMatcher |
getSearchMatcher()
Returns the current search string matcher. |
static java.lang.String |
getSearchString()
Returns the current search string. |
static boolean |
getSmartCaseReplace()
Returns if the replacement string will assume the same case as each specific occurrence of the search string. |
static boolean |
hyperSearch(View view)
Performs a HyperSearch. |
static boolean |
hyperSearch(View view,
boolean selection)
Performs a HyperSearch. |
static void |
load()
Loads search and replace state from the properties. |
static boolean |
replace(View view)
Replaces the current selection with the replacement string. |
static boolean |
replace(View view,
Buffer buffer,
int start,
int end)
Replaces text in the specified range with the replacement string. |
static boolean |
replaceAll(View view)
Replaces all occurances of the search string with the replacement string. |
static void |
save()
Saves search and replace state to the properties. |
static void |
setAutoWrapAround(boolean wrap)
Sets the state of the auto wrap around flag. |
static void |
setBeanShellReplace(boolean beanshell)
Sets the state of the BeanShell replace flag. |
static void |
setIgnoreCase(boolean ignoreCase)
Sets the ignore case flag. |
static void |
setRegexp(boolean regexp)
Sets the state of the regular expression flag. |
static void |
setReplaceString(java.lang.String replace)
Sets the current replacement string. |
static void |
setReverseSearch(boolean reverse)
Determines whether a reverse search will conducted from the current position to the beginning of a buffer. |
static void |
setSearchFileSet(SearchFileSet fileset)
Sets the current search file set. |
static void |
setSearchMatcher(SearchMatcher matcher)
Sets a custom search string matcher. |
static void |
setSearchString(java.lang.String search)
Sets the current search string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SearchAndReplace()
| Method Detail |
|---|
public static void setSearchString(java.lang.String search)
search - The new search stringpublic static java.lang.String getSearchString()
public static void setReplaceString(java.lang.String replace)
replace - The new replacement stringpublic static java.lang.String getReplaceString()
public static void setIgnoreCase(boolean ignoreCase)
ignoreCase - True if searches should be case insensitive,
false otherwisepublic static boolean getIgnoreCase()
public static void setRegexp(boolean regexp)
regexp - True if regular expression searches should be
performedpublic static boolean getRegexp()
public static void setReverseSearch(boolean reverse)
reverse - True if searches should go backwards,
false otherwisepublic static boolean getReverseSearch()
public static void setBeanShellReplace(boolean beanshell)
beanshell - True if the replace string is a BeanShell expressionpublic static boolean getBeanShellReplace()
public static void setAutoWrapAround(boolean wrap)
wrap - If true, the 'continue search from start' dialog
will not be displayedpublic static boolean getAutoWrapAround()
public static void setSearchMatcher(SearchMatcher matcher)
setSearchString(String),
setIgnoreCase(boolean), or setRegexp(boolean)
will reset the matcher to the default.
public static SearchMatcher getSearchMatcher()
throws java.lang.Exception
java.lang.IllegalArgumentException - if regular expression search
is enabled, the search string or replacement string is invalid
java.lang.Exceptionpublic static void setSearchFileSet(SearchFileSet fileset)
fileset - The file set to perform searches inAllBufferSet,
CurrentBufferSet,
DirectoryListSetpublic static SearchFileSet getSearchFileSet()
public static boolean getSmartCaseReplace()
public static boolean hyperSearch(View view)
view - The view
public static boolean hyperSearch(View view,
boolean selection)
view - The viewselection - If true, will only search in the current selection.
Note that the file set must be the current buffer file set for this
to work.public static boolean find(View view)
view - The view
public static boolean find(View view,
Buffer buffer,
int start)
throws java.lang.Exception
view - The viewbuffer - The bufferstart - Location where to start the search
java.lang.Exception
public static boolean find(View view,
Buffer buffer,
int start,
boolean firstTime,
boolean reverse)
throws java.lang.Exception
view - The viewbuffer - The bufferstart - Location where to start the searchfirstTime - See SearchMatcher#nextMatch(CharIndexed,
boolean,boolean,boolean,boolean).
java.lang.Exceptionpublic static boolean replace(View view)
view - The view
public static boolean replace(View view,
Buffer buffer,
int start,
int end)
view - The viewbuffer - The bufferstart - The start offsetend - The end offset
public static boolean replaceAll(View view)
view - The view
public static java.lang.String escapeRegexp(java.lang.String str,
boolean multiline)
multiline - Should \n be escaped?public static void load()
public static void save()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||