diff options
author | Markus Schorn | 2008-02-25 10:50:12 +0000 |
---|---|---|
committer | Markus Schorn | 2008-02-25 10:50:12 +0000 |
commit | 2c755c49c7d9740a3ff06c57f2466f350da6ded2 (patch) | |
tree | 4895506cca68d32ed7eaaaed98ee2f598ad79ce3 | |
parent | 349c825785e75f5aac8926037cf92e413e3b8203 (diff) | |
download | org.eclipse.cdt-2c755c49c7d9740a3ff06c57f2466f350da6ded2.tar.gz org.eclipse.cdt-2c755c49c7d9740a3ff06c57f2466f350da6ded2.tar.xz org.eclipse.cdt-2c755c49c7d9740a3ff06c57f2466f350da6ded2.zip |
IIndexManager manager operations can block too long, bug 220149.
2 files changed, 19 insertions, 15 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMRebuildTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMRebuildTask.java index ddbb9c4b681..56b12d1d2e7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMRebuildTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMRebuildTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.core.pdom.indexer; import java.util.ArrayList; @@ -94,19 +93,22 @@ public class PDOMRebuildTask implements IPDOMIndexerTask { TodoTaskUpdater.removeTasksFor(project.getProject()); } - private synchronized void createDelegate(ICProject project, IProgressMonitor monitor) throws CoreException { + private void createDelegate(ICProject project, IProgressMonitor monitor) throws CoreException { boolean allFiles= TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_ALL_FILES)); List sources= new ArrayList(); List headers= allFiles ? sources : null; TranslationUnitCollector collector= new TranslationUnitCollector(sources, headers, allFiles, monitor); project.accept(collector); ITranslationUnit[] tus= (ITranslationUnit[]) sources.toArray(new ITranslationUnit[sources.size()]); - fDelegate= fIndexer.createTask(tus, NO_TUS, NO_TUS); - if (fDelegate instanceof PDOMIndexerTask) { - final PDOMIndexerTask delegate = (PDOMIndexerTask) fDelegate; - delegate.setUpateFlags(IIndexManager.UPDATE_ALL); - delegate.setParseUpFront(); - delegate.setAllFilesProvided(allFiles); + IPDOMIndexerTask delegate= fIndexer.createTask(tus, NO_TUS, NO_TUS); + if (delegate instanceof PDOMIndexerTask) { + final PDOMIndexerTask pdomIndexerTask = (PDOMIndexerTask) delegate; + pdomIndexerTask.setUpateFlags(IIndexManager.UPDATE_ALL); + pdomIndexerTask.setParseUpFront(); + pdomIndexerTask.setAllFilesProvided(allFiles); + } + synchronized (this) { + fDelegate= delegate; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java index bec431a6c0c..6f177d99c68 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMUpdateTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.core.pdom.indexer; import java.util.ArrayList; @@ -74,7 +73,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask { } } - private synchronized void createDelegate(ICProject project, IProgressMonitor monitor) throws CoreException { + private void createDelegate(ICProject project, IProgressMonitor monitor) throws CoreException { boolean allFiles= TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_ALL_FILES)); HashSet set= new HashSet(); TranslationUnitCollector collector= new TranslationUnitCollector(set, set, allFiles, monitor); @@ -88,12 +87,15 @@ public class PDOMUpdateTask implements IPDOMIndexerTask { } } ITranslationUnit[] tus= (ITranslationUnit[]) set.toArray(new ITranslationUnit[set.size()]); - fDelegate= fIndexer.createTask(tus, NO_TUS, NO_TUS); - if (fDelegate instanceof PDOMIndexerTask) { - final PDOMIndexerTask task = (PDOMIndexerTask) fDelegate; + IPDOMIndexerTask delegate= fIndexer.createTask(tus, NO_TUS, NO_TUS); + if (delegate instanceof PDOMIndexerTask) { + final PDOMIndexerTask task = (PDOMIndexerTask) delegate; task.setUpateFlags(fUpdateOptions); task.setAllFilesProvided(allFiles); } + synchronized (this) { + fDelegate= delegate; + } } |