1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

bug 56411 - a request to index a project will restart a paused index

This commit is contained in:
Andrew Niefer 2004-05-14 19:15:51 +00:00
parent 21c8756a37
commit 35b475be54
2 changed files with 14 additions and 7 deletions

View file

@ -277,6 +277,11 @@ public class IndexManager extends JobManager implements IIndexConstants {
boolean indexEnabled = isIndexEnabled(project); boolean indexEnabled = isIndexEnabled(project);
if (indexEnabled){ if (indexEnabled){
if( enabledState() == WAITING ){
//if we are paused because the user cancelled a previous index, this is a good
//enough reason to restart
enable();
}
// check if the same request is not already in the queue // check if the same request is not already in the queue
IndexRequest request = new IndexAllProject(project, this); IndexRequest request = new IndexAllProject(project, this);
for (int i = this.jobEnd; i > this.jobStart; i--) // NB: don't check job at jobStart, as it may have already started (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32488) for (int i = this.jobEnd; i > this.jobStart; i--) // NB: don't check job at jobStart, as it may have already started (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32488)

View file

@ -35,9 +35,9 @@ public abstract class JobManager implements Runnable {
protected Thread thread; protected Thread thread;
/* flag indicating whether job execution is enabled or not */ /* flag indicating whether job execution is enabled or not */
private static final int ENABLED = 1; public static final int ENABLED = 1;
private static final int DISABLED = 0; public static final int DISABLED = 0;
private static final int WAITING = 2; public static final int WAITING = 2;
private int enabled = ENABLED; private int enabled = ENABLED;
public static boolean VERBOSE = false; public static boolean VERBOSE = false;
@ -379,11 +379,13 @@ public abstract class JobManager implements Runnable {
} }
awaitingJobs[jobEnd] = job; awaitingJobs[jobEnd] = job;
if( enabledState() == ENABLED ){
if( indexJob == null ){ if( indexJob == null ){
indexJob = new IndexingJob( thread, this ); indexJob = new IndexingJob( thread, this );
} else { } else {
indexJob.tickUp(); indexJob.tickUp();
} }
}
if (VERBOSE) if (VERBOSE)
JobManager.verbose("REQUEST background job - " + job); //$NON-NLS-1$ JobManager.verbose("REQUEST background job - " + job); //$NON-NLS-1$