IDEA-164031 Actions are disabled in modal dialogs
authorDenis Fokin <Denis.Fokin@jetbrains.com>
Wed, 16 Nov 2016 13:59:44 +0000 (16:59 +0300)
committerDenis Fokin <Denis.Fokin@jetbrains.com>
Wed, 16 Nov 2016 14:05:22 +0000 (17:05 +0300)
platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ActionUtil.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/Utils.java
platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java
platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java
platform/util/resources/misc/registry.properties

index bd72a0fa1ede41f9f90611285b53b9d15f7967c9..bec45fae330a6bb2860088f62baaf29dd116b4a1 100644 (file)
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.IndexNotReadyException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.ObjectUtils;
 import com.intellij.util.PausesStat;
@@ -110,7 +111,7 @@ public class ActionUtil {
     }
     final boolean enabledBeforeUpdate = presentation.isEnabled();
 
-    final boolean notAllowed = dumbMode && !action.isDumbAware() || (isInModalContext && !action.isEnabledInModalContext());
+    final boolean notAllowed = dumbMode && !action.isDumbAware() || (Registry.is("actionSystem.honor.modal.context") && isInModalContext && !action.isEnabledInModalContext());
 
     if (insidePerformDumbAwareUpdate++ == 0) {
       ActionPauses.STAT.started();
index 7f7105c5b43530f5e0e1fb423aafc6642f9508af..9cd7bf80e1d21664c83fc13f276ff61bfc9b3f96 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
 import com.intellij.openapi.actionSystem.ex.AnActionListener;
 import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.impl.LaterInvocator;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.keymap.ex.KeymapManagerEx;
 import com.intellij.openapi.ui.popup.*;
@@ -945,7 +946,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
     List<AnAction> newVisibleActions = ContainerUtil.newArrayListWithCapacity(myVisibleActions.size());
     DataContext dataContext = getDataContext();
 
-    Utils.expandActionGroup(false, myActionGroup, newVisibleActions, myPresentationFactory, dataContext,
+    Utils.expandActionGroup(LaterInvocator.isInModalContext(), myActionGroup, newVisibleActions, myPresentationFactory, dataContext,
                             myPlace, myActionManager, transparentOnly);
 
     if (forced || !newVisibleActions.equals(myVisibleActions)) {
index 8885f42daba4ca32df805f86d6b2d0c3b4e91a99..9a17463bb8b510484ad2cb4a572b677a5cd1a427 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.ide.DataManager;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.actionSystem.ex.ActionUtil;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.impl.LaterInvocator;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.project.DumbService;
@@ -156,7 +157,7 @@ public class Utils{
       actionManager,
       0
     );
-    if (!doUpdate(false, group, e, presentation)) return;
+    if (!doUpdate(isInModalContext, group, e, presentation)) return;
 
     if (!presentation.isVisible()) { // don't process invisible groups
       return;
@@ -432,7 +433,7 @@ public class Utils{
           if (!component.isShowing()) return;
 
           DataContext context1 = DataManager.getInstance().getDataContext();
-          expandActionGroup(false, group, new ArrayList<>(), presentationFactory, context1, place, ActionManager.getInstance());
+          expandActionGroup(LaterInvocator.isInModalContext(), group, new ArrayList<>(), presentationFactory, context1, place, ActionManager.getInstance());
 
           for (Component each : children) {
             if (each instanceof ActionMenuItem) {
index 0df47a849eaf48d85fe1ef9b44b855941ddded0b..15d4ef5e4fe5ca3242c913d63f1fbc8045e4e650 100644 (file)
@@ -608,7 +608,7 @@ public final class IdeKeyEventDispatcher implements Disposable {
         processor.createEvent(e, myContext.getDataContext(), ActionPlaces.MAIN_MENU, presentation, ActionManager.getInstance());
 
       try (AccessToken ignored = ProhibitAWTEvents.start("update")) {
-        ActionUtil.performDumbAwareUpdate(false, action, actionEvent, true);
+        ActionUtil.performDumbAwareUpdate(LaterInvocator.isInModalContext(), action, actionEvent, true);
       }
 
       if (dumb && !action.isDumbAware()) {
index 3b1148ebb67bc773f4e3e1521dbad602d9f6f64e..7d3f54a00a37676931798274d521947e64153cc6 100644 (file)
@@ -295,7 +295,7 @@ public class PopupFactoryImpl extends JBPopupFactory {
         new AnActionEvent(null, DataManager.getInstance().getDataContext(myComponent), myActionPlace, presentation,
                           ActionManager.getInstance(), 0);
       actionEvent.setInjectedContext(action.isInInjectedContext());
-      ActionUtil.performDumbAwareUpdate(false, action, actionEvent, false);
+      ActionUtil.performDumbAwareUpdate(LaterInvocator.isInModalContext(), action, actionEvent, false);
       return presentation;
     }
 
index 85b13698965636d4a4549318fa3f9d15317058e5..1e12206f655fa7a567ca62c90a47ac93c5cd0d33 100644 (file)
@@ -31,6 +31,7 @@ actionSystem.secondKeystrokeTimeout=2000
 actionSystem.secondKeystrokeAutoPopupEnabled=false
 actionSystem.secondKeystrokePopupTimeout=500
 actionSystem.win.suppressAlt=true
+actionSystem.honor.modal.context=false
 
 actionSystem.win.suppressAlt.new=true
 actionSystem.win.suppressAlt.new.description=Enables another approach to consume Alt which may move focus to main menu (Windows L&F only).