KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > util > TypeNameMatchCollector


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.util;
12
13 import java.util.Collection JavaDoc;
14
15 import org.eclipse.core.runtime.Assert;
16
17 import org.eclipse.jdt.core.search.TypeNameMatch;
18 import org.eclipse.jdt.core.search.TypeNameMatchRequestor;
19
20 public class TypeNameMatchCollector extends TypeNameMatchRequestor {
21
22     private final Collection JavaDoc fCollection;
23
24     public TypeNameMatchCollector(Collection JavaDoc collection) {
25         Assert.isNotNull(collection);
26         fCollection= collection;
27     }
28     
29     private boolean inScope(TypeNameMatch match) {
30         return !TypeFilter.isFiltered(match);
31     }
32     
33     /* (non-Javadoc)
34      * @see org.eclipse.jdt.core.search.TypeNameMatchRequestor#acceptTypeNameMatch(org.eclipse.jdt.core.search.TypeNameMatch)
35      */

36     public void acceptTypeNameMatch(TypeNameMatch match) {
37         if (inScope(match)) {
38             fCollection.add(match);
39         }
40     }
41
42 }
43
Popular Tags