KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > CollectingSearchRequestor


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.internal.corext.refactoring;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.List JavaDoc;
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.jdt.core.search.SearchMatch;
17 import org.eclipse.jdt.core.search.SearchRequestor;
18
19 /**
20  * Collects the results returned by a <code>SearchEngine</code>.
21  */

22 public class CollectingSearchRequestor extends SearchRequestor {
23     private ArrayList JavaDoc fFound;
24
25     public CollectingSearchRequestor() {
26         fFound= new ArrayList JavaDoc();
27     }
28     
29     /* (non-Javadoc)
30      * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch)
31      */

32     public void acceptSearchMatch(SearchMatch match) throws CoreException {
33         fFound.add(match);
34     }
35
36     /**
37      * @return a List of {@link SearchMatch}es (not sorted)
38      */

39     public List JavaDoc/*<SearchMatch>*/ getResults() {
40         return fFound;
41     }
42 }
43
44
45
Popular Tags