Package org.eclipse.search.core.text
Class TextSearchEngine
- java.lang.Object
-
- org.eclipse.search.core.text.TextSearchEngine
-
public abstract class TextSearchEngine extends Object
ATextSearchEngine
searches the content of a workspace file resources for matches to a given search pattern.create()
gives access to an instance of the search engine. By default this is the default text search engine (seecreateDefault()
) but extensions can offer more sophisticated search engine implementations.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description TextSearchEngine()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TextSearchEngine
create()
Creates an instance of the search engine.static TextSearchEngine
createDefault()
Creates the default, built-in, text search engine that implements a brute-force search, not using any search index.static Pattern
createPattern(String pattern, boolean isCaseSensitive, boolean isRegex)
Creates a pattern for the given search string and the given options.abstract IStatus
search(IFile[] scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor)
Uses a given search pattern to find matches in the content of workspace file resources.abstract IStatus
search(TextSearchScope scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor)
Uses a given search pattern to find matches in the content of workspace file resources.
-
-
-
Method Detail
-
create
public static TextSearchEngine create()
Creates an instance of the search engine. By default this is the default text search engine (seecreateDefault()
), but extensions can offer more sophisticated search engine implementations.- Returns:
- the created
TextSearchEngine
.
-
createDefault
public static TextSearchEngine createDefault()
Creates the default, built-in, text search engine that implements a brute-force search, not using any search index. Note that clients should always use the search engine provided bycreate()
.- Returns:
- an instance of the default text search engine
TextSearchEngine
.
-
search
public abstract IStatus search(TextSearchScope scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor)
Uses a given search pattern to find matches in the content of workspace file resources. If a file is open in an editor, the editor buffer is searched.- Parameters:
requestor
- the search requestor that gets the search resultsscope
- the scope defining the resources to search insearchPattern
- The search pattern used to find matches in the file contents.monitor
- the progress monitor to use- Returns:
- the status containing information about problems in resources searched.
-
search
public abstract IStatus search(IFile[] scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor)
Uses a given search pattern to find matches in the content of workspace file resources. If a file is open in an editor, the editor buffer is searched.- Parameters:
requestor
- the search requestor that gets the search resultsscope
- the files to search insearchPattern
- The search pattern used to find matches in the file contents.monitor
- the progress monitor to use- Returns:
- the status containing information about problems in resources searched.
-
createPattern
public static Pattern createPattern(String pattern, boolean isCaseSensitive, boolean isRegex) throws PatternSyntaxException
Creates a pattern for the given search string and the given options.- Parameters:
pattern
- the search pattern. IfisRegex
is:false
: a string including '*' and '?' wildcards and '\' for escaping the literals '*', '?' and '\'true
: a regex as specified byPattern
plus "\R" denoting a line delimiter (platform independent)
isRegex
-true
if the given string follows thePattern
including "\R"isCaseSensitive
- Set totrue
to create a case insensitive pattern- Returns:
- the created pattern
- Throws:
PatternSyntaxException
- if "\R" is at an illegal position- Since:
- 3.8
- See Also:
Pattern
-
-