diff --git a/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java b/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java index 85cb0db671d2..d0d02d9c2463 100644 --- a/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java +++ b/platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -166,33 +166,18 @@ public class ChooseRunConfigurationPopup implements ExecutorProvider { } }); - final Action action0 = createNumberAction(0, popup, myDefaultExecutor); - final Action action0_ = createNumberAction(0, popup, myAlternativeExecutor); - popup.registerAction("0Action", KeyStroke.getKeyStroke("0"), action0); - popup.registerAction("0Action_", KeyStroke.getKeyStroke("shift pressed 0"), action0_); - popup.registerAction("0Action1", KeyStroke.getKeyStroke("NUMPAD0"), action0); - popup.registerAction("0Action_1", KeyStroke.getKeyStroke("shift pressed NUMPAD0"), action0_); + for (int i = 0; i < 10; i++) { + addNumberAction(popup, i); + } + } - final Action action1 = createNumberAction(1, popup, myDefaultExecutor); - final Action action1_ = createNumberAction(1, popup, myAlternativeExecutor); - popup.registerAction("1Action", KeyStroke.getKeyStroke("1"), action1); - popup.registerAction("1Action_", KeyStroke.getKeyStroke("shift pressed 1"), action1_); - popup.registerAction("1Action1", KeyStroke.getKeyStroke("NUMPAD1"), action1); - popup.registerAction("1Action_1", KeyStroke.getKeyStroke("shift pressed NUMPAD1"), action1_); - - final Action action2 = createNumberAction(2, popup, myDefaultExecutor); - final Action action2_ = createNumberAction(2, popup, myAlternativeExecutor); - popup.registerAction("2Action", KeyStroke.getKeyStroke("2"), action2); - popup.registerAction("2Action_", KeyStroke.getKeyStroke("shift pressed 2"), action2_); - popup.registerAction("2Action1", KeyStroke.getKeyStroke("NUMPAD2"), action2); - popup.registerAction("2Action_1", KeyStroke.getKeyStroke("shift pressed NUMPAD2"), action2_); - - final Action action3 = createNumberAction(3, popup, myDefaultExecutor); - final Action action3_ = createNumberAction(3, popup, myAlternativeExecutor); - popup.registerAction("3Action", KeyStroke.getKeyStroke("3"), action3); - popup.registerAction("3Action_", KeyStroke.getKeyStroke("shift pressed 3"), action3_); - popup.registerAction("3Action1", KeyStroke.getKeyStroke("NUMPAD3"), action3); - popup.registerAction("3Action_1", KeyStroke.getKeyStroke("shift pressed NUMPAD3"), action3_); + private void addNumberAction(RunListPopup popup, int number) { + Action action = createNumberAction(number, popup, myDefaultExecutor); + Action action_ = createNumberAction(number, popup, myAlternativeExecutor); + popup.registerAction(number + "Action", KeyStroke.getKeyStroke(String.valueOf(number)), action); + popup.registerAction(number + "Action_", KeyStroke.getKeyStroke("shift pressed " + number), action_); + popup.registerAction(number + "Action1", KeyStroke.getKeyStroke("NUMPAD" + number), action); + popup.registerAction(number + "Action_1", KeyStroke.getKeyStroke("shift pressed NUMPAD" + number), action_); } private void updatePresentation() {