diff --git a/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java b/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java index 547e5147be79..8a0ee735cdc7 100644 --- a/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java +++ b/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java @@ -1,5 +1,4 @@ // Copyright 2000-2019 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.ide.actions; import com.intellij.icons.AllIcons; @@ -14,11 +13,7 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; -/** - * @author max - */ public abstract class QuickSwitchSchemeAction extends AnAction implements DumbAware { - protected static final Icon ourCurrentAction = AllIcons.Actions.Forward; protected static final Icon ourNotCurrentAction = new IconLoader.LazyIcon() { @Override diff --git a/platform/platform-impl/src/com/intellij/ide/actions/QuickChangeKeymapAction.java b/platform/platform-impl/src/com/intellij/ide/actions/QuickChangeKeymapAction.java index b92a5e3fb5ae..50918daecd3c 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/QuickChangeKeymapAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/QuickChangeKeymapAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// Copyright 2000-2019 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.ide.actions; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -7,30 +7,26 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.keymap.Keymap; import com.intellij.openapi.keymap.KeymapManager; import com.intellij.openapi.keymap.ex.KeymapManagerEx; +import com.intellij.openapi.keymap.impl.KeymapManagerImpl; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -/** - * @author max - */ -public class QuickChangeKeymapAction extends QuickSwitchSchemeAction { +public final class QuickChangeKeymapAction extends QuickSwitchSchemeAction { @Override protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) { - KeymapManagerEx manager = (KeymapManagerEx) KeymapManager.getInstance(); + KeymapManagerImpl manager = (KeymapManagerImpl)KeymapManager.getInstance(); Keymap current = manager.getActiveKeymap(); - for (Keymap keymap : manager.getAllKeymaps()) { - addKeymapAction(group, manager, current, keymap, false); + for (Keymap keymap : manager.getKeymaps(null)) { + addKeymapAction(group, manager, current, keymap); } } - private static void addKeymapAction(final DefaultActionGroup group, final KeymapManagerEx manager, final Keymap current, final Keymap keymap, final boolean addScheme) { + private static void addKeymapAction(@NotNull DefaultActionGroup group, @NotNull KeymapManagerEx manager, @Nullable Keymap current, @NotNull Keymap keymap) { group.add(new DumbAwareAction(keymap.getPresentableName(), "", keymap == current ? ourCurrentAction : ourNotCurrentAction) { @Override public void actionPerformed(@NotNull AnActionEvent e) { - if (addScheme) { - manager.getSchemeManager().addScheme(keymap, false); - } manager.setActiveKeymap(keymap); } }); @@ -38,6 +34,6 @@ public class QuickChangeKeymapAction extends QuickSwitchSchemeAction { @Override protected boolean isEnabled() { - return ((KeymapManagerEx) KeymapManager.getInstance()).getAllKeymaps().length > 1; + return ((KeymapManagerImpl)KeymapManager.getInstance()).getKeymaps(null).size() > 1; } }