com.borland.primetime.editor
Class SearchOptions

java.lang.Object
  |
  +--com.borland.primetime.editor.SearchOptions

public class SearchOptions
extends java.lang.Object

This object stores search options and is passed to the various SearchManager methods.


Field Summary
protected  boolean caseSensitive
          If true, the search is case sensitive, otherwise it's case insensitive.
protected  java.lang.String escapedSearchText
          Search for this text.
protected  RegularExpression[] filenameFilters
          Holds the filename filters, each expressed as a regular expression.
protected  boolean forwardSearch
          If true, the search is in the forward direction, otherwise in the backward direction.
protected  boolean fromCursor
          If true, the search is from the cursor, otherwise it's from the top of the file.
protected  boolean globalSearch
          If false, the search is in the selected text only, otherwise it is in all text.
protected  boolean promptReplace
          If true, prompt the user before each replace, otherwise don't prompt the user.
protected  boolean recurseDirectories
          If true, search directories recursively, otherwise search only one directory.
protected  boolean regExp
          If true, the search uses (limited) regular expressions, otherwise it doesn't.
protected  java.lang.String replaceText
          Replace with this text.
protected  java.lang.String searchText
          Search for this text.
protected  boolean wholeWordsOnly
          If true, search for whole words only, otherwise search for any occurrence.
 
Constructor Summary
SearchOptions()
          Construct a new SearchOptions object with default settings.
SearchOptions(SearchOptions opts)
          Construct a new SearchOptions object using settings from another SearchOptions object.
 
Method Summary
 java.lang.String getEscapedSearchText()
          Get the most recent search text, and escape all escape ('\') chars.
 RegularExpression[] getFilenameFilters()
          Get the RegularExpression array to use to filter filenames during a path search.
 java.lang.String getReplaceText()
          Get the most recent replace text.
 java.lang.String getSearchText()
          Get the most recent search text.
 boolean isCaseSensitive()
          Get the case sensistive setting.
 boolean isForwardSearch()
          Get the forward search setting.
 boolean isFromCursor()
          Get the origin from cursor setting.
 boolean isGlobalSearch()
          Get the global search setting.
 boolean isPromptReplace()
          Get the prompt on replace setting.
 boolean isRecurseDirectories()
          Get the recurse directories setting.
 boolean isRegExp()
          Get the regular expressions setting.
 boolean isWholeWordsOnly()
          Get the whole words only setting.
 void setCaseSensitive(boolean b)
          Set the case sensitive setting.
 void setFilenameFilters(RegularExpression[] filters)
          Set the RegularExpression to use to filter filenames during a path search.
 void setForwardSearch(boolean b)
          Set the forward search setting.
 void setFromCursor(boolean b)
          Set the origin from cursor setting.
 void setGlobalSearch(boolean b)
          Set the global search setting.
 void setPromptReplace(boolean b)
          Set the prompt on replace setting.
 void setRecurseDirectories(boolean b)
          Set the recurse directories setting.
 void setRegExp(boolean b)
          Set the regular expressions setting.
 void setReplaceText(java.lang.String text)
          Set the most recent replace text.
 void setSearchText(java.lang.String text)
          Set the most recent search text.
 void setWholeWordsOnly(boolean b)
          Set the whole words only setting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

searchText

protected java.lang.String searchText
Search for this text.

replaceText

protected java.lang.String replaceText
Replace with this text.

escapedSearchText

protected java.lang.String escapedSearchText
Search for this text. All '\' characters have been escaped, meaning they are preceded with an extra '\' character.

caseSensitive

protected boolean caseSensitive
If true, the search is case sensitive, otherwise it's case insensitive.

regExp

protected boolean regExp
If true, the search uses (limited) regular expressions, otherwise it doesn't.

forwardSearch

protected boolean forwardSearch
If true, the search is in the forward direction, otherwise in the backward direction.

globalSearch

protected boolean globalSearch
If false, the search is in the selected text only, otherwise it is in all text.

fromCursor

protected boolean fromCursor
If true, the search is from the cursor, otherwise it's from the top of the file.

promptReplace

protected boolean promptReplace
If true, prompt the user before each replace, otherwise don't prompt the user.

wholeWordsOnly

protected boolean wholeWordsOnly
If true, search for whole words only, otherwise search for any occurrence.

recurseDirectories

protected boolean recurseDirectories
If true, search directories recursively, otherwise search only one directory.

filenameFilters

protected RegularExpression[] filenameFilters
Holds the filename filters, each expressed as a regular expression.
Constructor Detail

SearchOptions

public SearchOptions()
Construct a new SearchOptions object with default settings.

SearchOptions

public SearchOptions(SearchOptions opts)
Construct a new SearchOptions object using settings from another SearchOptions object.
Parameters:
opts - The SearchOptions object to use to initialize this one.
Method Detail

getSearchText

public java.lang.String getSearchText()
Get the most recent search text.
Returns:
The string most recently searched for.

getEscapedSearchText

public java.lang.String getEscapedSearchText()
Get the most recent search text, and escape all escape ('\') chars. So if you search for "?", this function will return "\\u1234".

setSearchText

public void setSearchText(java.lang.String text)
Set the most recent search text.
Parameters:
text - The most recent search text.

getReplaceText

public java.lang.String getReplaceText()
Get the most recent replace text.
Returns:
The string most recently used as the replacement string.

setReplaceText

public void setReplaceText(java.lang.String text)
Set the most recent replace text.
Parameters:
text - The most recent text used as a replacement string.

isCaseSensitive

public boolean isCaseSensitive()
Get the case sensistive setting.
Returns:
True if the most recent search was case sensitive.

setCaseSensitive

public void setCaseSensitive(boolean b)
Set the case sensitive setting.
Parameters:
b - The new case sensitive setting.

isRegExp

public boolean isRegExp()
Get the regular expressions setting.
Returns:
True if the most recent search used regular expressions.

setRegExp

public void setRegExp(boolean b)
Set the regular expressions setting.
Parameters:
b - The new regular expressions setting.

isForwardSearch

public boolean isForwardSearch()
Get the forward search setting.
Returns:
True if the most recent search was forward.

setForwardSearch

public void setForwardSearch(boolean b)
Set the forward search setting.
Parameters:
b - The new foward search setting. True to search forward, false to search backwards.

isGlobalSearch

public boolean isGlobalSearch()
Get the global search setting.
Returns:
True if the most recent search was global in scope (vs. only the selected text).

setGlobalSearch

public void setGlobalSearch(boolean b)
Set the global search setting.
Parameters:
b - The new global search setting. True to search all of the text, false to search only the selected text.

isFromCursor

public boolean isFromCursor()
Get the origin from cursor setting.
Returns:
True if the most recent search was from the cursor position (vs. from the start or end of the file).

setFromCursor

public void setFromCursor(boolean b)
Set the origin from cursor setting.
Parameters:
b - The new origin from cursor setting. True to search from the cusor position, false to search from the top (or bottom) of the file.

isPromptReplace

public boolean isPromptReplace()
Get the prompt on replace setting.
Returns:
True if the most recent search was from the cursor position (vs. from the start or end of the file).

setPromptReplace

public void setPromptReplace(boolean b)
Set the prompt on replace setting.
Parameters:
b - The new prompt on replace setting. True to prompt before a replace operation is performed

isRecurseDirectories

public boolean isRecurseDirectories()
Get the recurse directories setting.
Returns:
True if a path search using this set of options should recursively search subdirectories.

setRecurseDirectories

public void setRecurseDirectories(boolean b)
Set the recurse directories setting.
Parameters:
b - True if a path search using this set of options should recursively search subdirectories.

isWholeWordsOnly

public boolean isWholeWordsOnly()
Get the whole words only setting.
Returns:
True if a search using this set of options will only consider whole words, not parts of words.

setWholeWordsOnly

public void setWholeWordsOnly(boolean b)
Set the whole words only setting.
Parameters:
b - True if a search using this set of options should only consider whole words, not parts of words.

getFilenameFilters

public RegularExpression[] getFilenameFilters()
Get the RegularExpression array to use to filter filenames during a path search.
Returns:
An array of RegularExpression objects used to filter filenames during a path search.

setFilenameFilters

public void setFilenameFilters(RegularExpression[] filters)
Set the RegularExpression to use to filter filenames during a path search.
Parameters:
filter - An array of RegularExpression objects to use to filter filenames during a path search.