IDEA-188519 Actions that do not show popup because of dumb mode fail typeahead

This commit is contained in:
Denis Fokin
2018-03-19 18:05:37 +03:00
parent a4cb153596
commit f5002ec244
3 changed files with 22 additions and 1 deletions
@@ -229,6 +229,8 @@ public class IdeEventQueue extends EventQueue {
addDispatcher(new EditingCanceller(), null);
abracadabraDaberBoreh();
IdeKeyEventDispatcher.addDumbModeWarningListener(() -> flushDelayedKeyEvents());
}
private void abracadabraDaberBoreh() {
@@ -1386,7 +1388,7 @@ public class IdeEventQueue extends EventQueue {
return true;
}
private void flushDelayedKeyEvents() {
public void flushDelayedKeyEvents() {
delayKeyEvents.set(false);
int size = myDelayedKeyEvents.size();
for (int keyEventIndex = 0; keyEventIndex < size; keyEventIndex++) {
@@ -0,0 +1,6 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.keymap.impl;
public interface DumbModeWarningListener {
void actionCanceledBecauseOfDumbMode();
}
@@ -628,6 +628,13 @@ public final class IdeKeyEventDispatcher implements Disposable {
}
if (!nonDumbAwareAction.isEmpty()) {
if (dumbModeWarningListener != null) {
dumbModeWarningListener.actionCanceledBecauseOfDumbMode();
}
IdeEventQueue.getInstance().flushDelayedKeyEvents();
showDumbModeWarningLaterIfNobodyConsumesEvent(e, nonDumbAwareAction.toArray(new AnActionEvent[0]));
}
@@ -644,6 +651,12 @@ public final class IdeKeyEventDispatcher implements Disposable {
}
}
private static DumbModeWarningListener dumbModeWarningListener = null;
public static void addDumbModeWarningListener (DumbModeWarningListener listener) {
dumbModeWarningListener = listener;
}
/**
* This method fills {@code myActions} list.
* @return true if there is a shortcut with second stroke found.