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:
parent
9f0e997443
commit
3b3f194391
1 changed files with 7 additions and 14 deletions
|
@ -1241,7 +1241,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
if (IndexerPreferences.KEY_INDEX_ON_OPEN.equals(event.getKey())) {
|
if (IndexerPreferences.KEY_INDEX_ON_OPEN.equals(event.getKey())) {
|
||||||
ICElement element= getInputCElement();
|
ICElement element= getInputCElement();
|
||||||
ITranslationUnit tu = element != null ? (ITranslationUnit) element : null;
|
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) {
|
if (element instanceof ITranslationUnit) {
|
||||||
ITranslationUnit tu = (ITranslationUnit) element;
|
ITranslationUnit tu = (ITranslationUnit) element;
|
||||||
updateIndexInclusion(tu, false);
|
updateIndexInclusion(tu);
|
||||||
fBracketMatcher.configure(tu.getLanguage());
|
fBracketMatcher.configure(tu.getLanguage());
|
||||||
} else {
|
} else {
|
||||||
updateIndexInclusion(null, false);
|
updateIndexInclusion(null);
|
||||||
fBracketMatcher.configure(null);
|
fBracketMatcher.configure(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateIndexInclusion(ITranslationUnit tu, boolean synchronous) {
|
private void updateIndexInclusion(ITranslationUnit tu) {
|
||||||
if (tu!= null) {
|
if (tu != null) {
|
||||||
IProject project = tu.getCProject().getProject();
|
IProject project = tu.getCProject().getProject();
|
||||||
if (!String.valueOf(true).equals(IndexerPreferences.get(project, IndexerPreferences.KEY_INDEX_ON_OPEN, null))) {
|
if (!String.valueOf(true).equals(IndexerPreferences.get(project, IndexerPreferences.KEY_INDEX_ON_OPEN, null))) {
|
||||||
tu = null;
|
tu = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tu != null || fTuAddedToIndex != null) {
|
if ((tu != null || fTuAddedToIndex != null) && tu != fTuAddedToIndex) {
|
||||||
IndexUpdateRequestorJob job = new IndexUpdateRequestorJob(tu, fTuAddedToIndex);
|
IndexUpdateRequestorJob job = new IndexUpdateRequestorJob(tu, fTuAddedToIndex);
|
||||||
fTuAddedToIndex = tu;
|
fTuAddedToIndex = tu;
|
||||||
job.schedule();
|
job.schedule();
|
||||||
if (synchronous) {
|
|
||||||
try {
|
|
||||||
job.join();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// Ignore.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2215,7 +2208,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
fIndexerPreferenceListener.unregister();
|
fIndexerPreferenceListener.unregister();
|
||||||
updateIndexInclusion(null, true);
|
updateIndexInclusion(null);
|
||||||
|
|
||||||
ISourceViewer sourceViewer = getSourceViewer();
|
ISourceViewer sourceViewer = getSourceViewer();
|
||||||
if (sourceViewer instanceof ITextViewerExtension)
|
if (sourceViewer instanceof ITextViewerExtension)
|
||||||
|
|
Loading…
Add table
Reference in a new issue