Index: editor/tools/plugins/com.google.dart.tools.search/src/com/google/dart/tools/search/core/text/TextSearchRequestor.java |
=================================================================== |
--- editor/tools/plugins/com.google.dart.tools.search/src/com/google/dart/tools/search/core/text/TextSearchRequestor.java (revision 7355) |
+++ editor/tools/plugins/com.google.dart.tools.search/src/com/google/dart/tools/search/core/text/TextSearchRequestor.java (working copy) |
@@ -13,9 +13,10 @@ |
*/ |
package com.google.dart.tools.search.core.text; |
+import org.eclipse.core.resources.IFile; |
import org.eclipse.core.runtime.CoreException; |
-import org.eclipse.core.resources.IFile; |
+import java.io.File; |
/** |
* Collects the results from a search engine query. Clients implement a subclass to pass to |
@@ -42,6 +43,54 @@ |
public abstract class TextSearchRequestor { |
/** |
+ * Notification sent before search starts in the given file. This method is called for all files |
+ * that are contained in the search scope. Implementors can decide if the file content should be |
+ * searched for search matches or not. |
+ * <p> |
+ * The default behaviour is to search the file for matches. |
+ * </p> |
+ * |
+ * @param file the file resource to be searched. |
+ * @return If false, no pattern matches will be reported for the content of this file. |
+ * @throws CoreException implementors can throw a {@link CoreException} if accessing the resource |
+ * fails or another problem prevented the processing of the search match. |
+ */ |
+ public boolean acceptExternalFile(File file) throws CoreException { |
+ return true; |
+ } |
+ |
+ /** |
+ * Notification sent before search starts in the given file. This method is called for all files |
+ * that are contained in the search scope. Implementors can decide if the file content should be |
+ * searched for search matches or not. |
+ * <p> |
+ * The default behaviour is to search the file for matches. |
+ * </p> |
+ * |
+ * @param file the file resource to be searched. |
+ * @return If false, no pattern matches will be reported for the content of this file. |
+ * @throws CoreException implementors can throw a {@link CoreException} if accessing the resource |
+ * fails or another problem prevented the processing of the search match. |
+ */ |
+ public boolean acceptFile(IFile file) throws CoreException { |
+ return true; |
+ } |
+ |
+ /** |
+ * Accepts the given search match and decides if the search should continue for this file. |
+ * |
+ * @param 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. |
+ * @return If false is returned no further matches will be reported for this file. |
+ * @throws CoreException implementors can throw a {@link CoreException} if accessing the resource |
+ * fails or another problem prevented the processing of the search match. |
+ */ |
+ public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException { |
+ return true; |
+ } |
+ |
+ /** |
* Notification sent before starting the search action. Typically, this would tell a search |
* requestor to clear previously recorded search results. |
* <p> |
@@ -64,20 +113,24 @@ |
} |
/** |
- * Notification sent before search starts in the given file. This method is called for all files |
- * that are contained in the search scope. Implementors can decide if the file content should be |
- * searched for search matches or not. |
+ * Notification sent that a file might contain binary context. It is the choice of the search |
+ * engine to report binary files and it is the heuristic of the search engine to decide that a |
+ * file could be binary. Implementors can decide if the file content should be searched for search |
+ * matches or not. |
* <p> |
- * The default behaviour is to search the file for matches. |
+ * This call is sent after calls {link {@link #acceptExternalFile(File)} that return |
+ * <code>true</code> and before any matches reported for this file with |
+ * {@link #acceptPatternMatch(TextSearchMatchAccess)}. |
* </p> |
+ * <p> |
+ * The default behaviour is to skip binary files |
+ * </p> |
* |
- * @param file the file resource to be searched. |
+ * @param file the file that might be binary |
* @return If false, no pattern matches will be reported for the content of this file. |
- * @throws CoreException implementors can throw a {@link CoreException} if accessing the resource |
- * fails or another problem prevented the processing of the search match. |
*/ |
- public boolean acceptFile(IFile file) throws CoreException { |
- return true; |
+ public boolean reportBinaryExternalFile(File file) { |
+ return false; |
} |
/** |
@@ -101,18 +154,4 @@ |
return false; |
} |
- /** |
- * Accepts the given search match and decides if the search should continue for this file. |
- * |
- * @param 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. |
- * @return If false is returned no further matches will be reported for this file. |
- * @throws CoreException implementors can throw a {@link CoreException} if accessing the resource |
- * fails or another problem prevented the processing of the search match. |
- */ |
- public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException { |
- return true; |
- } |
- |
} |