From 3b3f194391396d440a0d28685f58db9ed13fd30c Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 20 Jan 2012 16:40:35 -0800 Subject: [PATCH] Don't wait for IndexUpdateRequestorJob in CEditor.dispose() since it may cause a significant delay in "Close All" command. --- .../cdt/internal/ui/editor/CEditor.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index d7691a06d7e..6ab5dc189f7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -1241,7 +1241,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC if (IndexerPreferences.KEY_INDEX_ON_OPEN.equals(event.getKey())) { ICElement element= getInputCElement(); ITranslationUnit tu = element != null ? (ITranslationUnit) element : null; - updateIndexInclusion(tu, false); + updateIndexInclusion(tu); } } @@ -1520,32 +1520,25 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC if (element instanceof ITranslationUnit) { ITranslationUnit tu = (ITranslationUnit) element; - updateIndexInclusion(tu, false); + updateIndexInclusion(tu); fBracketMatcher.configure(tu.getLanguage()); } else { - updateIndexInclusion(null, false); + updateIndexInclusion(null); fBracketMatcher.configure(null); } } - private void updateIndexInclusion(ITranslationUnit tu, boolean synchronous) { - if (tu!= null) { + private void updateIndexInclusion(ITranslationUnit tu) { + if (tu != null) { IProject project = tu.getCProject().getProject(); if (!String.valueOf(true).equals(IndexerPreferences.get(project, IndexerPreferences.KEY_INDEX_ON_OPEN, null))) { tu = null; } } - if (tu != null || fTuAddedToIndex != null) { + if ((tu != null || fTuAddedToIndex != null) && tu != fTuAddedToIndex) { IndexUpdateRequestorJob job = new IndexUpdateRequestorJob(tu, fTuAddedToIndex); fTuAddedToIndex = tu; job.schedule(); - if (synchronous) { - try { - job.join(); - } catch (InterruptedException e) { - // Ignore. - } - } } } @@ -2215,7 +2208,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC @Override public void dispose() { fIndexerPreferenceListener.unregister(); - updateIndexInclusion(null, true); + updateIndexInclusion(null); ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer instanceof ITextViewerExtension)