From 8d8309c532a611f91ee916edfec270055d2a2bad Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Mon, 18 Jun 2012 14:25:43 +0400 Subject: [PATCH] stop daemon while showing file structure --- .../intellij/ide/util/FileStructurePopup.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 747cb5dbbe3b..08246d11fa90 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -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() {