Backspace unindent restored in Python console (PY-3005).
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 30 Mar 2011 12:28:05 +0000 (16:28 +0400)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Thu, 31 Mar 2011 10:19:07 +0000 (14:19 +0400)
platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java
platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java

index fc703f549627159caf2234022c622efb5ea8bd4a..09c30e60cc333047f77c9d84478299a9a4640bbe 100644 (file)
@@ -135,7 +135,7 @@ public abstract class AbstractConsoleRunnerWithHistory {
       new RunContentDescriptor(myConsoleView, myProcessHandler, panel, constructConsoleTitle(myConsoleTitle));
 
 // tool bar actions
-    final AnAction[] actions = fillToolBarActions(toolbarActions, defaultExecutor, contentDescriptor);
+    final List<AnAction> actions = fillToolBarActions(toolbarActions, defaultExecutor, contentDescriptor);
     registerActionShortcuts(actions, getLanguageConsole().getConsoleEditor().getComponent());
     registerActionShortcuts(actions, panel);
     panel.updateUI();
@@ -202,7 +202,7 @@ public abstract class AbstractConsoleRunnerWithHistory {
 
   protected abstract OSProcessHandler createProcessHandler(final Process process, final String commandLine);
 
-  public static void registerActionShortcuts(final AnAction[] actions, final JComponent component) {
+  public static void registerActionShortcuts(final List<AnAction> actions, final JComponent component) {
     for (AnAction action : actions) {
       if (action.getShortcutSet() != null) {
         action.registerCustomShortcutSet(action.getShortcutSet(), component);
@@ -210,9 +210,9 @@ public abstract class AbstractConsoleRunnerWithHistory {
     }
   }
 
-  protected AnAction[] fillToolBarActions(final DefaultActionGroup toolbarActions,
-                                          final Executor defaultExecutor,
-                                          final RunContentDescriptor contentDescriptor) {
+  protected List<AnAction> fillToolBarActions(final DefaultActionGroup toolbarActions,
+                                              final Executor defaultExecutor,
+                                              final RunContentDescriptor contentDescriptor) {
 
     List<AnAction> actionList = Lists.newArrayList();
 
@@ -230,11 +230,9 @@ public abstract class AbstractConsoleRunnerWithHistory {
 // Help
     actionList.add(CommonActionsManager.getInstance().createHelpAction("interactive_console"));
 
-    AnAction[] actions = actionList.toArray(new AnAction[actionList.size()]);
+    toolbarActions.addAll(actionList);
 
-    toolbarActions.addAll(actions);
-
-    return actions;
+    return actionList;
   }
 
   protected AnAction createCloseAction(final Executor defaultExecutor, final RunContentDescriptor myDescriptor) {
@@ -250,8 +248,8 @@ public abstract class AbstractConsoleRunnerWithHistory {
   }
 
   public static AnAction createConsoleExecAction(final LanguageConsoleImpl languageConsole,
-                                                       final ProcessHandler processHandler,
-                                                       final ConsoleExecuteActionHandler consoleExecuteActionHandler) {
+                                                 final ProcessHandler processHandler,
+                                                 final ConsoleExecuteActionHandler consoleExecuteActionHandler) {
     return new ConsoleExecuteAction(languageConsole, processHandler, consoleExecuteActionHandler);
   }
 
index c6cad49946fb2c793eb87a7e7ec7bfeaa74ed561..390858ef118cd7e9dcdf2bb20adfe34cde484f0d 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -291,6 +292,12 @@ public class DefaultActionGroup extends ActionGroup {
     }
   }
 
+  public final void addAll(Collection<AnAction> actionList) {
+    for (AnAction each : actionList) {
+      add(each);
+    }
+  }
+
   public final void addAll(AnAction... actions) {
     for (AnAction each : actions) {
       add(each);