KickJava   Java API By Example, From Geeks To Geeks.

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


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.runtime.CoreException;
14
15 /**
16  * Collects the results from a search engine query.
17  * Clients implement a subclass to pass to <code>SearchEngine.search</code>
18  * and implement the {@link #acceptSearchMatch(SearchMatch)} method, and
19  * possibly override other life cycle methods.
20  * <p>
21  * The search engine calls <code>beginReporting()</code> when a search starts,
22  * then calls <code>acceptSearchMatch(...)</code> for each search result, and
23  * finally calls <code>endReporting()</code>. The order of the search results
24  * is unspecified and may vary from request to request; when displaying results,
25  * clients should not rely on the order but should instead arrange the results
26  * in an order that would be more meaningful to the user.
27  * </p>
28  *
29  * @see SearchEngine
30  * @since 3.0
31  */

32 public abstract class SearchRequestor {
33
34     /**
35      * Accepts the given search match.
36      *
37      * @param match the found match
38      * @throws CoreException
39      */

40     public abstract void acceptSearchMatch(SearchMatch match) throws CoreException;
41
42     /**
43      * Notification sent before starting the search action.
44      * Typically, this would tell a search requestor to clear previously
45      * recorded search results.
46      * <p>
47      * The default implementation of this method does nothing. Subclasses
48      * may override.
49      * </p>
50      */

51     public void beginReporting() {
52         // do nothing
53
}
54
55     /**
56      * Notification sent after having completed the search action.
57      * Typically, this would tell a search requestor collector that no more
58      * results will be forthcomping in this search.
59      * <p>
60      * The default implementation of this method does nothing. Subclasses
61      * may override.
62      * </p>
63      */

64     public void endReporting() {
65         // do nothing
66
}
67
68     /**
69      * Intermediate notification sent when the given participant starts to
70      * contribute.
71      * <p>
72      * The default implementation of this method does nothing. Subclasses
73      * may override.
74      * </p>
75      *
76      * @param participant the participant that is starting to contribute
77      */

78     public void enterParticipant(SearchParticipant participant) {
79         // do nothing
80
}
81
82     /**
83      * Intermediate notification sent when the given participant is finished
84      * contributing.
85      * <p>
86      * The default implementation of this method does nothing. Subclasses
87      * may override.
88      * </p>
89      *
90      * @param participant the participant that finished contributing
91      */

92     public void exitParticipant(SearchParticipant participant) {
93         // do nothing
94
}
95 }
96
Popular Tags