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:
parent
21c8756a37
commit
35b475be54
2 changed files with 14 additions and 7 deletions
|
@ -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)
|
||||||
|
|
|
@ -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,10 +379,12 @@ public abstract class JobManager implements Runnable {
|
||||||
}
|
}
|
||||||
awaitingJobs[jobEnd] = job;
|
awaitingJobs[jobEnd] = job;
|
||||||
|
|
||||||
if( indexJob == null ){
|
if( enabledState() == ENABLED ){
|
||||||
indexJob = new IndexingJob( thread, this );
|
if( indexJob == null ){
|
||||||
} else {
|
indexJob = new IndexingJob( thread, this );
|
||||||
indexJob.tickUp();
|
} else {
|
||||||
|
indexJob.tickUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VERBOSE)
|
if (VERBOSE)
|
||||||
|
|
Loading…
Add table
Reference in a new issue