KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > search > indexing > IndexRequest


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.core.search.indexing;
12
13 import org.eclipse.core.runtime.IPath;
14 import org.eclipse.jdt.internal.core.search.processing.IJob;
15
16 public abstract class IndexRequest implements IJob {
17     protected boolean isCancelled = false;
18     protected IPath containerPath;
19     protected IndexManager manager;
20
21     public IndexRequest(IPath containerPath, IndexManager manager) {
22         this.containerPath = containerPath;
23         this.manager = manager;
24     }
25     public boolean belongsTo(String JavaDoc projectNameOrJarPath) {
26         // used to remove pending jobs because the project was deleted... not to delete index files
27
// can be found either by project name or JAR path name
28
return projectNameOrJarPath.equals(this.containerPath.segment(0))
29             || projectNameOrJarPath.equals(this.containerPath.toString());
30     }
31     public void cancel() {
32         this.manager.jobWasCancelled(this.containerPath);
33         this.isCancelled = true;
34     }
35     public void ensureReadyToRun() {
36         // tag the index as inconsistent
37
this.manager.aboutToUpdateIndex(this.containerPath, updatedIndexState());
38     }
39     protected Integer JavaDoc updatedIndexState() {
40         return IndexManager.UPDATING_STATE;
41     }
42 }
43
Popular Tags