IdeEventQueue and IdeKeyEventDispatcher should not access KeymapManager if app is not yet loaded

GitOrigin-RevId: 72be9de8487ffe0eb703c2ad35609a52492db80a
This commit is contained in:
Vladimir Krivosheev
2019-07-11 17:42:27 +03:00
committed by intellij-monorepo-bot
parent be856427f7
commit 1d5bcdfb91
2 changed files with 10 additions and 3 deletions
@@ -13,6 +13,7 @@ import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.actionSystem.impl.ActionManagerImpl;
import com.intellij.openapi.application.*;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.application.impl.LaterInvocator;
import com.intellij.openapi.components.ServiceManager;
@@ -1471,9 +1472,15 @@ public final class IdeEventQueue extends EventQueue {
private final List<String> actionsShowingPopupsList = new ArrayList<>();
private long lastTypeaheadTimestamp = -1;
@Nullable
public static KeymapManager getKeymapManager() {
ApplicationEx app = ApplicationManagerEx.getApplicationEx();
return app != null && app.isLoaded() ? KeymapManager.getInstance() : null;
}
@NotNull
private Set<Shortcut> getShortcutsShowingPopups () {
KeymapManager keymapManager = KeymapManager.getInstance();
KeymapManager keymapManager = getKeymapManager();
if (keymapManager != null) {
Keymap keymap = keymapManager.getActiveKeymap();
if (!keymap.equals(lastActiveKeymap.get())) {
@@ -712,7 +712,7 @@ public final class IdeKeyEventDispatcher implements Disposable {
}
// search in main keymap
KeymapManager keymapManager = KeymapManager.getInstance();
KeymapManager keymapManager = IdeEventQueue.getKeymapManager();
Keymap keymap = keymapManager == null ? null : keymapManager.getActiveKeymap();
String[] actionIds = keymap == null ? ArrayUtilRt.EMPTY_STRING_ARRAY : keymap.getActionIds(sc);
ActionManager actionManager = ActionManager.getInstance();
@@ -932,7 +932,7 @@ public final class IdeKeyEventDispatcher implements Disposable {
return false;
}
KeymapManager manager = KeymapManager.getInstance();
KeymapManager manager = IdeEventQueue.getKeymapManager();
if (manager == null) {
return false;
}