KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > search > IQueryParticipant


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.ui.search;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 /**
17  * This is the interface expected of extensions to the extension point
18  * <code>org.eclipse.jdt.ui.queryParticipants</code>.
19  * <p>
20  * A <code>IQueryParticipant</code> is called during the execution of a
21  * Java search query. It can report matches via an {@link ISearchRequestor} and
22  * may contribute a {@link IMatchPresentation} to help render the elements it contributes.
23  * </p>
24  * <p>
25  * Clients may implement this interface.
26  * </p>
27  *
28  * @since 3.0
29  */

30 public interface IQueryParticipant {
31     /**
32      * Executes the search described by the given <code>querySpecification</code>. Matches are reported
33      * to the given <code>requester</code>.
34      * The interpretation of what a given Java search (e.g. "References to class Foo") means is up to the
35      * participant.
36      * @param requestor The requester to report matches to.
37      * @param querySpecification The specification of the query to run.
38      * @param monitor A monitor to report progress on.
39      * @throws CoreException Thrown when the search can not be executed
40      */

41     void search(ISearchRequestor requestor, QuerySpecification querySpecification, IProgressMonitor monitor) throws CoreException;
42     /**
43      * Returns the number of units of work estimated. The returned number should be normalized such
44      * that the number of ticks for the original Java search job is 1000. For example if the participant
45      * uses the same amount of time as the Java search, it should return 1000, if it uses half the time,
46      * it should return 500, etc.
47      * This method is supposed to give a quick estimate of the work to be done and is assumed
48      * to be much faster than the actual query.
49      * @param specification the specification to estimate.
50      * @return The number of ticks estimated.
51      */

52     int estimateTicks(QuerySpecification specification);
53     /**
54      * Gets the UI participant responsible for handling the display of elements not known to the Java search UI. The Java search UI knows
55      * elements are of type <code>IJavaElement</code> and <code>IResource</code>.
56      * A participant may return <code>null</code> if matches are only reported against elements of type <code>IResource</code> and <code>IJavaElement</code>.
57      * @return The UI participant for this query participant or <code>null</code>.
58      */

59     IMatchPresentation getUIParticipant();
60 }
61
Popular Tags