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