KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > search > IJavaSearchResultCollector


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core.search;
12
13 import org.eclipse.core.resources.IResource;
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.IProgressMonitor;
16
17 import org.eclipse.jdt.core.IJavaElement;
18
19 /**
20  * A <code>IJavaSearchResultCollector</code> collects search results from a <code>search</code>
21  * query to a <code>SearchEngine</code>. Clients must implement this interface and pass
22  * an instance to the <code>search(...)</code> methods. When a search starts, the <code>aboutToStart()</code>
23  * method is called, then 0 or more call to <code>accept(...)</code> are done, finally the
24  * <code>done()</code> method is called.
25  * <p>
26  * Results provided to this collector may be accurate - in this case they have an <code>EXACT_MATCH</code> accuracy -
27  * or they might be potential matches only - they have a <code>POTENTIAL_MATCH</code> accuracy. This last
28  * case can occur when a problem prevented the <code>SearchEngine</code> from resolving the match.
29  * </p>
30  * <p>
31  * The order of the results is unspecified. Clients must not rely on this order to display results,
32  * but they should sort these results (for example, in syntactical order).
33  * <p>
34  * The <code>IJavaSearchResultCollector</code> is also used to provide a progress monitor to the
35  * <code>SearchEngine</code>.
36  * </p>
37  * <p>
38  * Clients may implement this interface.
39  * </p>
40  *
41  * @see SearchEngine
42  * @deprecated Since 3.0, the class
43  * {@link org.eclipse.jdt.core.search.SearchRequestor} replaces this interface.
44  */

45 public interface IJavaSearchResultCollector {
46     /**
47      * The search result corresponds exactly to the search pattern.
48      *
49      * @deprecated Use {@link SearchMatch#A_ACCURATE} instead.
50      */

51     int EXACT_MATCH = 0;
52
53     /**
54      * The search result is potentially a match for the search pattern,
55      * but a problem prevented the search engine from being more accurate
56      * (typically because of the classpath was not correctly set).
57      *
58      * @deprecated Use {@link SearchMatch#A_INACCURATE} instead.
59      */

60      int POTENTIAL_MATCH = 1;
61
62 /**
63  * Called before the actual search starts.
64  *
65  * @deprecated Replaced by {@link SearchRequestor#beginReporting()}.
66  */

67 public void aboutToStart();
68 /**
69  * Accepts the given search result.
70  *
71  * @param resource the resource in which the match has been found
72  * @param start the start position of the match, -1 if it is unknown
73  * @param end the end position of the match, -1 if it is unknown;
74  * the ending offset is exclusive, meaning that the actual range of characters
75  * covered is <code>[start, end]</code>
76  * @param enclosingElement the Java element that contains the character range
77  * <code>[start, end]</code>; the value can be <code>null</code> indicating that
78  * no enclosing Java element has been found
79  * @param accuracy the level of accuracy the search result has; either
80  * <code>EXACT_MATCH</code> or <code>POTENTIAL_MATCH</code>
81  * @exception CoreException if this collector had a problem accepting the search result
82  * @deprecated Replaced by {@link SearchRequestor#acceptSearchMatch(SearchMatch)}.
83  */

84 public void accept(
85     IResource resource,
86     int start,
87     int end,
88     IJavaElement enclosingElement,
89     int accuracy)
90     throws CoreException;
91 /**
92  * Called when the search has ended.
93  *
94  * @deprecated Replaced by {@link SearchRequestor#endReporting()}.
95  */

96 public void done();
97 /**
98  * Returns the progress monitor used to report progress.
99  *
100  * @return a progress monitor or null if no progress monitor is provided
101  */

102 public IProgressMonitor getProgressMonitor();
103 }
104
Popular Tags