allow bg dumb mode inside CheckoutAction (EA-75341 - Throwable: DumbServiceImpl.sched...
authorpeter <peter@jetbrains.com>
Wed, 28 Oct 2015 16:54:23 +0000 (17:54 +0100)
committerpeter <peter@jetbrains.com>
Wed, 28 Oct 2015 17:52:54 +0000 (18:52 +0100)
platform/vcs-impl/src/com/intellij/openapi/vcs/checkout/CheckoutAction.java

index 463eb392ac83427abb38fa5a09424fb010f67082..224cacbc79e0ebf8ae6aff3a9d4c88e16f520d19 100644 (file)
@@ -18,9 +18,7 @@ package com.intellij.openapi.vcs.checkout;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.project.DumbAware;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.project.*;
 import com.intellij.openapi.vcs.CheckoutProvider;
 import com.intellij.openapi.vcs.ProjectLevelVcsManager;
 
@@ -32,10 +30,15 @@ public class CheckoutAction extends AnAction implements DumbAware {
     myProvider = provider;
   }
 
-  public void actionPerformed(AnActionEvent e) {
-    Project project = e.getData(CommonDataKeys.PROJECT);
-    project = (project == null) ? ProjectManager.getInstance().getDefaultProject() : project;
-    myProvider.doCheckout(project, getListener(project));
+  public void actionPerformed(final AnActionEvent e) {
+    DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
+      @Override
+      public void run() {
+        Project project = e.getData(CommonDataKeys.PROJECT);
+        project = (project == null) ? ProjectManager.getInstance().getDefaultProject() : project;
+        myProvider.doCheckout(project, getListener(project));
+      }
+    });
   }
 
   protected CheckoutProvider.Listener getListener(Project project) {