01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 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.core.search;
11:
12: import org.eclipse.core.runtime.IProgressMonitor;
13: import org.eclipse.jdt.core.search.*;
14: import org.eclipse.jdt.internal.compiler.util.SimpleSet;
15: import org.eclipse.jdt.internal.core.index.Index;
16:
17: public class SubTypeSearchJob extends PatternSearchJob {
18:
19: SimpleSet indexes = new SimpleSet(5);
20:
21: public SubTypeSearchJob(SearchPattern pattern,
22: SearchParticipant participant, IJavaSearchScope scope,
23: IndexQueryRequestor requestor) {
24: super (pattern, participant, scope, requestor);
25: }
26:
27: public void finished() {
28: Object[] values = this .indexes.values;
29: for (int i = 0, l = values.length; i < l; i++)
30: if (values[i] != null)
31: ((Index) values[i]).stopQuery();
32: }
33:
34: public boolean search(Index index, IProgressMonitor progressMonitor) {
35: if (index == null)
36: return COMPLETE;
37: if (indexes.addIfNotIncluded(index) == index)
38: index.startQuery();
39: return super.search(index, progressMonitor);
40: }
41: }
|