stop daemon while showing file structure

This commit is contained in:
Konstantin Bulenkov
2012-06-18 14:26:54 +04:00
parent c4817c8e4e
commit 8d8309c532
@@ -15,6 +15,8 @@
*/
package com.intellij.ide.util;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
import com.intellij.ide.DataManager;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.structureView.StructureViewModel;
@@ -115,6 +117,7 @@ public class FileStructurePopup implements Disposable {
private String myTestSearchFilter;
private final ActionCallback myTreeHasBuilt = new ActionCallback();
private boolean myInitialNodeIsLeaf;
private final boolean myDaemonUpdateEnabled;
public FileStructurePopup(StructureViewModel structureViewModel,
@Nullable Editor editor,
@@ -123,6 +126,16 @@ public class FileStructurePopup implements Disposable {
final boolean applySortAndFilter) {
myProject = project;
myEditor = editor;
//Stop code analyzer to speedup EDT
final DaemonCodeAnalyzer analyzer = DaemonCodeAnalyzer.getInstance(myProject);
if (analyzer != null) {
myDaemonUpdateEnabled = ((DaemonCodeAnalyzerImpl)analyzer).isUpdateByTimerEnabled();
analyzer.setUpdateByTimerEnabled(false);
} else {
myDaemonUpdateEnabled = false;
}
IdeFocusManager.getInstance(myProject).typeAheadUntil(myTreeHasBuilt);
myBaseTreeModel = structureViewModel;
Disposer.register(this, auxDisposable);
@@ -398,6 +411,10 @@ public class FileStructurePopup implements Disposable {
}
public void dispose() {
final DaemonCodeAnalyzer analyzer = DaemonCodeAnalyzer.getInstance(myProject);
if (analyzer != null) {
analyzer.setUpdateByTimerEnabled(myDaemonUpdateEnabled);
}
}
protected static String getDimensionServiceKey() {