01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.corext.refactoring;
11:
12: import java.util.ArrayList;
13: import java.util.List;
14: import org.eclipse.core.runtime.CoreException;
15: import org.eclipse.jdt.core.search.SearchMatch;
16: import org.eclipse.jdt.core.search.SearchRequestor;
17:
18: /**
19: * Collects the results returned by a <code>SearchEngine</code>.
20: */
21: public class CollectingSearchRequestor extends SearchRequestor {
22: private ArrayList fFound;
23:
24: public CollectingSearchRequestor() {
25: fFound = new ArrayList();
26: }
27:
28: /* (non-Javadoc)
29: * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch)
30: */
31: public void acceptSearchMatch(SearchMatch match)
32: throws CoreException {
33: fFound.add(match);
34: }
35:
36: /**
37: * @return a List of {@link SearchMatch}es (not sorted)
38: */
39: public List/*<SearchMatch>*/getResults() {
40: return fFound;
41: }
42: }
|