1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Don't wait for IndexUpdateRequestorJob in CEditor.dispose() since it

may cause a significant delay in "Close All" command.
This commit is contained in:
Sergey Prigogin 2012-01-20 16:40:35 -08:00
parent 9f0e997443
commit 3b3f194391

View file

@ -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)