disable safe delete while in dumb mode (EA-64997 - INRE: FileBasedIndexImpl.handleDum...
authorpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 12:14:24 +0000 (13:14 +0100)
committerpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 15:18:45 +0000 (16:18 +0100)
platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteDialog.java

index 1d997a30d0afcfc882bf9d5e25be6f9348357d20..7141c2519a2a322577cada7a400861d6be8dbeec 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.ide.IdeBundle;
 import com.intellij.ide.util.DeleteUtil;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.help.HelpManager;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.psi.PsiElement;
@@ -39,6 +40,7 @@ import java.awt.event.ActionListener;
  * @author dsl
  */
 public class SafeDeleteDialog extends DialogWrapper {
+  private final Project myProject;
   private final PsiElement[] myElements;
   private final Callback myCallback;
 
@@ -55,6 +57,7 @@ public class SafeDeleteDialog extends DialogWrapper {
 
   public SafeDeleteDialog(Project project, PsiElement[] elements, Callback callback) {
     super(project, true);
+    myProject = project;
     myElements = elements;
     myCallback = callback;
     myDelegate = getDelegate();
@@ -190,6 +193,11 @@ public class SafeDeleteDialog extends DialogWrapper {
 
   @Override
   protected void doOKAction() {
+    if (DumbService.isDumb(myProject)) {
+      DumbService.getInstance(myProject).showDumbModeNotification("Safe delete refactoring is not available while indexing is in process");
+      return;
+    }
+
     if (myCallback != null && isSafeDelete()) {
       myCallback.run(this);
     } else {