enable slow findClass in parameter info popup update (EA-65010 - INRE: FileBasedIndex...
authorpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 11:57:09 +0000 (12:57 +0100)
committerpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 15:18:43 +0000 (16:18 +0100)
platform/core-api/src/com/intellij/openapi/project/DumbService.java
platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java

index b70196ea2acfcccf6a0cc14571ebb46503b8c5fb..68ca99133e4687418b57d51879c0cd375f839457 100644 (file)
@@ -241,6 +241,20 @@ public abstract class DumbService {
    */
   public abstract void setAlternativeResolveEnabled(boolean enabled);
 
+  /**
+   * Invokes the given runnable with alternative resolve set to true.
+   * @see #setAlternativeResolveEnabled(boolean) 
+   */
+  public void withAlternativeResolveEnabled(@NotNull Runnable runnable) {
+    setAlternativeResolveEnabled(true);
+    try {
+      runnable.run();
+    }
+    finally {
+      setAlternativeResolveEnabled(false);
+    }
+  }
+
   /**
    * @return whether alternative resolution is enabled for the current thread.
    * 
index 359cf711cc9e4e92abd745c1be3abb54968aa916..c92fe6c9f16e4de28525ffa72360f62ee434660f 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.editor.ScrollType;
 import com.intellij.openapi.editor.event.*;
 import com.intellij.openapi.editor.impl.EditorImpl;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Key;
@@ -240,7 +241,14 @@ public class ParameterInfoController implements Disposable {
     Runnable request = new Runnable(){
       @Override
       public void run(){
-        if (!myDisposed && !myProject.isDisposed()) updateComponent();
+        if (!myDisposed && !myProject.isDisposed()) {
+          DumbService.getInstance(myProject).withAlternativeResolveEnabled(new Runnable() {
+            @Override
+            public void run() {
+              updateComponent();
+            }
+          });
+        }
       }
     };
     myAlarm.addRequest(request, DELAY, ModalityState.stateForComponent(myEditor.getComponent()));