mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
2005-08-11 Chris Wiebe
Fix PRs 104907,106415: type cache always running in background * browser/org/eclipse/cdt/core/browser/AllTypesCache.java * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
This commit is contained in:
parent
9df072a4b2
commit
d6a0d5d0d1
3 changed files with 37 additions and 29 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-08-11 Chris Wiebe
|
||||||
|
Fix PR 104907,106415: type cache always running in background
|
||||||
|
* browser/org/eclipse/cdt/core/browser/AllTypesCache.java
|
||||||
|
* browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
|
||||||
|
|
||||||
2005-07-26 Alain Magloire
|
2005-07-26 Alain Magloire
|
||||||
Fix PR 100992: IMethod were generated for implementation, we should generate
|
Fix PR 100992: IMethod were generated for implementation, we should generate
|
||||||
IFunction for method defines outside of the class shell.
|
IFunction for method defines outside of the class shell.
|
||||||
|
|
|
@ -68,15 +68,16 @@ public class AllTypesCache {
|
||||||
fgTypeHierarchyBuilder = new TypeHierarchyBuilder();
|
fgTypeHierarchyBuilder = new TypeHierarchyBuilder();
|
||||||
|
|
||||||
// load prefs
|
// load prefs
|
||||||
Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
// Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
if (prefs.contains(ENABLE_BACKGROUND_TYPE_CACHE)) {
|
// if (prefs.contains(ENABLE_BACKGROUND_TYPE_CACHE)) {
|
||||||
fgEnableIndexing = prefs.getBoolean(ENABLE_BACKGROUND_TYPE_CACHE);
|
// fgEnableIndexing = prefs.getBoolean(ENABLE_BACKGROUND_TYPE_CACHE);
|
||||||
} else {
|
// } else {
|
||||||
prefs.setDefault(ENABLE_BACKGROUND_TYPE_CACHE, true);
|
// prefs.setDefault(ENABLE_BACKGROUND_TYPE_CACHE, false);
|
||||||
prefs.setValue(ENABLE_BACKGROUND_TYPE_CACHE, true);
|
// prefs.setValue(ENABLE_BACKGROUND_TYPE_CACHE, false);
|
||||||
CCorePlugin.getDefault().savePluginPreferences();
|
// CCorePlugin.getDefault().savePluginPreferences();
|
||||||
fgEnableIndexing = true;
|
// fgEnableIndexing = true;
|
||||||
}
|
// }
|
||||||
|
fgEnableIndexing = false;
|
||||||
|
|
||||||
// start jobs in background after INITIAL_DELAY
|
// start jobs in background after INITIAL_DELAY
|
||||||
TypeCacheManager.getInstance().reconcile(fgEnableIndexing, Job.BUILD, INITIAL_DELAY);
|
TypeCacheManager.getInstance().reconcile(fgEnableIndexing, Job.BUILD, INITIAL_DELAY);
|
||||||
|
@ -89,22 +90,22 @@ public class AllTypesCache {
|
||||||
};
|
};
|
||||||
CoreModel.getDefault().addElementChangedListener(fgElementChangedListener);
|
CoreModel.getDefault().addElementChangedListener(fgElementChangedListener);
|
||||||
|
|
||||||
// add property change listener
|
// // add property change listener
|
||||||
fgPropertyChangeListener = new IPropertyChangeListener() {
|
// fgPropertyChangeListener = new IPropertyChangeListener() {
|
||||||
public void propertyChange(PropertyChangeEvent event) {
|
// public void propertyChange(PropertyChangeEvent event) {
|
||||||
String property = event.getProperty();
|
// String property = event.getProperty();
|
||||||
if (property.equals(ENABLE_BACKGROUND_TYPE_CACHE)) {
|
// if (property.equals(ENABLE_BACKGROUND_TYPE_CACHE)) {
|
||||||
String value = (String) event.getNewValue();
|
// String value = (String) event.getNewValue();
|
||||||
fgEnableIndexing = Boolean.valueOf(value).booleanValue();
|
// fgEnableIndexing = Boolean.valueOf(value).booleanValue();
|
||||||
if (!fgEnableIndexing) {
|
// if (!fgEnableIndexing) {
|
||||||
TypeCacheManager.getInstance().cancelJobs();
|
// TypeCacheManager.getInstance().cancelJobs();
|
||||||
} else {
|
// } else {
|
||||||
TypeCacheManager.getInstance().reconcile(fgEnableIndexing, Job.BUILD, 0);
|
// TypeCacheManager.getInstance().reconcile(fgEnableIndexing, Job.BUILD, 0);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
prefs.addPropertyChangeListener(fgPropertyChangeListener);
|
// prefs.addPropertyChangeListener(fgPropertyChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,6 +119,7 @@ public class TypeCacherJob extends BasicJob {
|
||||||
|
|
||||||
private void flush(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
|
private void flush(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
|
||||||
// flush the cache
|
// flush the cache
|
||||||
|
boolean success = true;
|
||||||
IProject project = fTypeCache.getProject();
|
IProject project = fTypeCache.getProject();
|
||||||
|
|
||||||
monitor.beginTask("", 100); //$NON-NLS-1$
|
monitor.beginTask("", 100); //$NON-NLS-1$
|
||||||
|
@ -126,11 +127,11 @@ public class TypeCacherJob extends BasicJob {
|
||||||
fTypeCache.flush(scope);
|
fTypeCache.flush(scope);
|
||||||
if (!scope.encloses(project)) {
|
if (!scope.encloses(project)) {
|
||||||
if (project.exists() && project.isOpen()) {
|
if (project.exists() && project.isOpen()) {
|
||||||
doIndexerJob(new IndexerDependenciesJob(fIndexManager, fTypeCache, scope), monitor);
|
success = doIndexerJob(new IndexerDependenciesJob(fIndexManager, fTypeCache, scope), monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( monitor.isCanceled() ) {
|
if (!success || monitor.isCanceled()) {
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,14 +139,15 @@ public class TypeCacherJob extends BasicJob {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
|
private void update(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
|
||||||
|
boolean success = true;
|
||||||
IProject project = fTypeCache.getProject();
|
IProject project = fTypeCache.getProject();
|
||||||
|
|
||||||
monitor.beginTask("", 100); //$NON-NLS-1$
|
monitor.beginTask("", 100); //$NON-NLS-1$
|
||||||
if (project.exists() && project.isOpen()) {
|
if (project.exists() && project.isOpen()) {
|
||||||
doIndexerJob(new IndexerTypesJob2(fIndexManager, fTypeCache, scope), monitor);
|
success = doIndexerJob(new IndexerTypesJob2(fIndexManager, fTypeCache, scope), monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor.isCanceled()) {
|
if (!success || monitor.isCanceled()) {
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue