001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.core.search;
011:
012: import org.eclipse.core.resources.IResource;
013: import org.eclipse.core.runtime.CoreException;
014: import org.eclipse.core.runtime.IProgressMonitor;
015:
016: import org.eclipse.jdt.core.IJavaElement;
017:
018: /**
019: * A <code>IJavaSearchResultCollector</code> collects search results from a <code>search</code>
020: * query to a <code>SearchEngine</code>. Clients must implement this interface and pass
021: * an instance to the <code>search(...)</code> methods. When a search starts, the <code>aboutToStart()</code>
022: * method is called, then 0 or more call to <code>accept(...)</code> are done, finally the
023: * <code>done()</code> method is called.
024: * <p>
025: * Results provided to this collector may be accurate - in this case they have an <code>EXACT_MATCH</code> accuracy -
026: * or they might be potential matches only - they have a <code>POTENTIAL_MATCH</code> accuracy. This last
027: * case can occur when a problem prevented the <code>SearchEngine</code> from resolving the match.
028: * </p>
029: * <p>
030: * The order of the results is unspecified. Clients must not rely on this order to display results,
031: * but they should sort these results (for example, in syntactical order).
032: * <p>
033: * The <code>IJavaSearchResultCollector</code> is also used to provide a progress monitor to the
034: * <code>SearchEngine</code>.
035: * </p>
036: * <p>
037: * Clients may implement this interface.
038: * </p>
039: *
040: * @see SearchEngine
041: * @deprecated Since 3.0, the class
042: * {@link org.eclipse.jdt.core.search.SearchRequestor} replaces this interface.
043: */
044: public interface IJavaSearchResultCollector {
045: /**
046: * The search result corresponds exactly to the search pattern.
047: *
048: * @deprecated Use {@link SearchMatch#A_ACCURATE} instead.
049: */
050: int EXACT_MATCH = 0;
051:
052: /**
053: * The search result is potentially a match for the search pattern,
054: * but a problem prevented the search engine from being more accurate
055: * (typically because of the classpath was not correctly set).
056: *
057: * @deprecated Use {@link SearchMatch#A_INACCURATE} instead.
058: */
059: int POTENTIAL_MATCH = 1;
060:
061: /**
062: * Called before the actual search starts.
063: *
064: * @deprecated Replaced by {@link SearchRequestor#beginReporting()}.
065: */
066: public void aboutToStart();
067:
068: /**
069: * Accepts the given search result.
070: *
071: * @param resource the resource in which the match has been found
072: * @param start the start position of the match, -1 if it is unknown
073: * @param end the end position of the match, -1 if it is unknown;
074: * the ending offset is exclusive, meaning that the actual range of characters
075: * covered is <code>[start, end]</code>
076: * @param enclosingElement the Java element that contains the character range
077: * <code>[start, end]</code>; the value can be <code>null</code> indicating that
078: * no enclosing Java element has been found
079: * @param accuracy the level of accuracy the search result has; either
080: * <code>EXACT_MATCH</code> or <code>POTENTIAL_MATCH</code>
081: * @exception CoreException if this collector had a problem accepting the search result
082: * @deprecated Replaced by {@link SearchRequestor#acceptSearchMatch(SearchMatch)}.
083: */
084: public void accept(IResource resource, int start, int end,
085: IJavaElement enclosingElement, int accuracy)
086: throws CoreException;
087:
088: /**
089: * Called when the search has ended.
090: *
091: * @deprecated Replaced by {@link SearchRequestor#endReporting()}.
092: */
093: public void done();
094:
095: /**
096: * Returns the progress monitor used to report progress.
097: *
098: * @return a progress monitor or null if no progress monitor is provided
099: */
100: public IProgressMonitor getProgressMonitor();
101: }
|