public abstract class TextSearchRequestor extends Object
TextSearchEngine.search(TextSearchScope,
TextSearchRequestor, java.util.regex.Pattern, org.eclipse.core.runtime.IProgressMonitor)
and implement the acceptPatternMatch(TextSearchMatchAccess)
method, and possibly override other life cycle methods.
The search engine calls beginReporting()
when a search starts,
then calls acceptFile(IFile)
for a file visited.
If acceptFile(IFile)
returns true
reportBinaryFile(IFile)
is
called if the file could be binary followed by
acceptPatternMatch(TextSearchMatchAccess)
for each pattern match found
in this file. The end of the search is signaled with a call to endReporting()
.
Note that acceptFile(IFile)
is called for all files in the search scope,
even if no match can be found.
The order of the search results is unspecified and may vary from request to request; when displaying results, clients should not rely on the order but should instead arrange the results in an order that would be more meaningful to the user.
TextSearchEngine
Constructor and Description |
---|
TextSearchRequestor() |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptFile(IFile file)
Notification sent before search starts in the given file.
|
boolean |
acceptPatternMatch(TextSearchMatchAccess matchAccess)
Accepts the given search match and decides if the search should continue for this file.
|
void |
beginReporting()
Notification sent before starting the search action.
|
void |
endReporting()
Notification sent after having completed the search action.
|
boolean |
reportBinaryFile(IFile file)
Notification sent that a file might contain binary context.
|
public void beginReporting()
The default implementation of this method does nothing. Subclasses may override.
public void endReporting()
The default implementation of this method does nothing. Subclasses may override.
public boolean acceptFile(IFile file) throws CoreException
The default behaviour is to search the file for matches.
file
- the file resource to be searched.CoreException
- implementors can throw a CoreException
if accessing the resource fails or another
problem prevented the processing of the search match.public boolean reportBinaryFile(IFile file)
This call is sent after calls {link acceptFile(IFile)
that return true
and before any matches
reported for this file with acceptPatternMatch(TextSearchMatchAccess)
.
The default behaviour is to skip binary files
file
- the file that might be binarypublic boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException
matchAccess
- gives access to information of the match found. The matchAccess is not a value
object. Its value might change after this method is finished, and the element might be reused.CoreException
- implementors can throw a CoreException
if accessing the resource fails or another
problem prevented the processing of the search match.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.