Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2005-08-04 23:47:41 +0000
committerAlain Magloire2005-08-04 23:47:41 +0000
commitc41e10d0bcd36ec1352084eb2e37923f69d11b3c (patch)
tree0a54e929113ba2725a414d5c27242a0784f2a900
parentbe20b267ca5d4a11c40ec69fb34b718f08897ac4 (diff)
downloadorg.eclipse.cdt-c41e10d0bcd36ec1352084eb2e37923f69d11b3c.tar.gz
org.eclipse.cdt-c41e10d0bcd36ec1352084eb2e37923f69d11b3c.tar.xz
org.eclipse.cdt-c41e10d0bcd36ec1352084eb2e37923f69d11b3c.zip
2005-08-04 Alain Magloire
Fix taken from 3.0 PR 104907 * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheJob.java
-rw-r--r--core/org.eclipse.cdt.core/ChangeLog5
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java39
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java10
3 files changed, 34 insertions, 20 deletions
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 063e5002056..c485c512a53 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,4 +1,9 @@
2005-08-04 Alain Magloire
+ Fix taken from 3.0 PR 104907
+ * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java
+ * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheJob.java
+
+2005-08-04 Alain Magloire
Part fix for PR 100992: The signature was incorrect for structure/unions.
* model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java
index 01a35be01e1..b0f33e76b07 100644
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java
+++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java
@@ -31,6 +31,8 @@ import org.eclipse.cdt.core.browser.TypeSearchScope;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.internal.core.browser.util.ArrayUtil;
+import org.eclipse.cdt.internal.core.model.CModelManager;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -681,25 +683,34 @@ public class TypeCache implements ITypeCache {
if (deltasRemaining() == 0)
return; // nothing to do
- TypeCacherJob deltaJob;
+ TypeCacherJob deltaJob = null;
+ IndexManager indexManager = CModelManager.getDefault().getIndexManager();
+ boolean haveIndexer = indexManager.isIndexEnabled( fProject );
synchronized(fDeltas) {
- // grab all the remaining deltas
- TypeCacheDelta[] jobDeltas = (TypeCacheDelta[]) fDeltas.toArray(new TypeCacheDelta[fDeltas.size()]);
-
- // create a new job
- deltaJob = new TypeCacherJob(this, jobDeltas, enableIndexing);
- // assign deltas to job
- if (jobDeltas != null) {
- for (int i = 0; i < jobDeltas.length; ++i) {
- jobDeltas[i].assignToJob(deltaJob);
+ if( haveIndexer ){
+ // grab all the remaining deltas
+ TypeCacheDelta[] jobDeltas = (TypeCacheDelta[]) fDeltas.toArray(new TypeCacheDelta[fDeltas.size()]);
+
+ // create a new job
+ deltaJob = new TypeCacherJob(this, jobDeltas, enableIndexing);
+ // assign deltas to job
+ if (jobDeltas != null) {
+ for (int i = 0; i < jobDeltas.length; ++i) {
+ jobDeltas[i].assignToJob(deltaJob);
+ }
}
+ } else {
+ //we don't have an indexer, don't create a job to do these deltas, throw them away
+ fDeltas.clear();
}
}
- // schedule the new job
- deltaJob.addJobChangeListener(fJobChangeListener);
- deltaJob.setPriority(priority);
- deltaJob.schedule(delay);
+ if( deltaJob != null ){
+ // schedule the new job
+ deltaJob.addJobChangeListener(fJobChangeListener);
+ deltaJob.setPriority(priority);
+ deltaJob.schedule(delay);
+ }
}
public void reconcileAndWait(boolean enableIndexing, int priority, IProgressMonitor monitor) {
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
index de7f1dc706b..863610233ea 100644
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
+++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
@@ -119,7 +119,6 @@ public class TypeCacherJob extends BasicJob {
private void flush(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
// flush the cache
- boolean success = true;
IProject project = fTypeCache.getProject();
monitor.beginTask("", 100); //$NON-NLS-1$
@@ -127,11 +126,11 @@ public class TypeCacherJob extends BasicJob {
fTypeCache.flush(scope);
if (!scope.encloses(project)) {
if (project.exists() && project.isOpen()) {
- success = doIndexerJob(new IndexerDependenciesJob(fIndexManager, fTypeCache, scope), monitor);
+ doIndexerJob(new IndexerDependenciesJob(fIndexManager, fTypeCache, scope), monitor);
}
}
- if (!success || monitor.isCanceled()) {
+ if ( monitor.isCanceled() ) {
throw new InterruptedException();
}
@@ -139,15 +138,14 @@ public class TypeCacherJob extends BasicJob {
}
private void update(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
- boolean success = true;
IProject project = fTypeCache.getProject();
monitor.beginTask("", 100); //$NON-NLS-1$
if (project.exists() && project.isOpen()) {
- success = doIndexerJob(new IndexerTypesJob(fIndexManager, fTypeCache, scope), monitor);
+ doIndexerJob(new IndexerTypesJob(fIndexManager, fTypeCache, scope), monitor);
}
- if (!success || monitor.isCanceled()) {
+ if (monitor.isCanceled()) {
throw new InterruptedException();
}

Back to the top