From b1b64cdbc6b02de73f012ab5bb89d0e4d509f047 Mon Sep 17 00:00:00 2001 From: Gregory Shrago Date: Tue, 3 May 2011 19:20:27 +0400 Subject: [PATCH] [peter] IDEA-69028 'Recent Files' problems with database console --- platform/icons/src/actions/consoleHistory.png | Bin 0 -> 768 bytes .../console/ConsoleHistoryController.java | 3 ++- .../console/LanguageConsoleImpl.java | 15 ++----------- .../openapi/actionSystem/EmptyAction.java | 20 +++++++++++++++--- .../src/messages/ActionsBundle.properties | 11 ++++++++++ .../src/idea/Keymap_Default.xml | 1 + .../src/idea/PlatformActions.xml | 9 ++++---- 7 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 platform/icons/src/actions/consoleHistory.png diff --git a/platform/icons/src/actions/consoleHistory.png b/platform/icons/src/actions/consoleHistory.png new file mode 100644 index 0000000000000000000000000000000000000000..9ac71e7ec590607127630e6d9388a47dc79b107f GIT binary patch literal 768 zcmV+b1ONPqP)_vFl6j zZmzqnJ2Q7~XJ*yiwJtOF%+EdN`#JYYLI~V_`0_jcH-u0iNjyC+EcnFJj$4N`!}LVs z+HbbLw!O7(-$vfrWJL*?v8(U(qHc=*<>;Ris|kISr2__|+>YE7Fo_vm6zQD{I1~v5 zISegVF6>%fiCyyfej+!|J9*sKT{Q&W>RyX+#*SU4OS&tPCBcJ@5WK)-gm2Byn{xTa(D z!zi?b23LMTG|Rd5TsRa$s(?spzuDZ7)J>C<$tZHE(1`o^_$LIHe!=Nit;L)Jzb4eT_n9SG+U;*&Vc+fuixqNr5jr9Epvr} zOF3t1FT$DaUTMD96V?rDD@oMK1Wbh!s0ztCOq<8h+o8dUiO;p6NW87Eop&tV&jPbt zrPe5nk-^N4Y;zl};q&>5KaP#ncq=RM#rwX)`li4jj*{J4K^uz8bU3*JPDSL+1$z5? ynk-Bcx8bA0000 actionList = - (ArrayList)myConsoleEditor.getComponent().getClientProperty(AnAction.ourClientProperty); - if (actionList != null) { - for (AnAction anAction : actionList) { - anAction.registerCustomShortcutSet(anAction.getShortcutSet(), component); - } - } - } - public Editor getCurrentEditor() { return myCurrentEditor; } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java index c362e0470d47..542ab6cd70ee 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java @@ -19,6 +19,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.ArrayList; /** * @author Gregory.Shrago @@ -36,13 +37,26 @@ public class EmptyAction extends AnAction { public static void setupAction(@NotNull AnAction action, @NotNull String id, @Nullable JComponent component) { final AnAction emptyAction = ActionManager.getInstance().getAction(id); - if (action.getTemplatePresentation().getIcon() == null) { - action.getTemplatePresentation().setIcon(emptyAction.getTemplatePresentation().getIcon()); + final Presentation copyFrom = emptyAction.getTemplatePresentation(); + final Presentation copyTo = action.getTemplatePresentation(); + if (copyTo.getIcon() == null) { + copyTo.setIcon(copyFrom.getIcon()); } - action.getTemplatePresentation().setText(emptyAction.getTemplatePresentation().getText()); + copyTo.setText(copyFrom.getText()); + copyTo.setDescription(copyFrom.getDescription()); action.registerCustomShortcutSet(emptyAction.getShortcutSet(), component); } + public static void registerActionShortcuts(JComponent component, final JComponent fromComponent) { + final ArrayList actionList = + (ArrayList)fromComponent.getClientProperty(ourClientProperty); + if (actionList != null) { + for (AnAction anAction : actionList) { + anAction.registerCustomShortcutSet(anAction.getShortcutSet(), component); + } + } + } + public static AnAction wrap(final AnAction action) { return action instanceof ActionGroup ? new ActionGroup() { { diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index 1a72c33c5b88..618d12942776 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -1232,3 +1232,14 @@ action.ExcludeFromProject.text=Exclude From Project... group.MarkFileAs.text=Mark File As action.MarkAsPlainTextAction.text=Mark as Plain Text action.MarkAsOriginalTypeAction.text=Mark as + +action.Console.Execute.text=Execute Current Statement +action.Console.Execute.description=Execute current statement in console +action.Console.History.Previous.text=Previous +action.Console.History.Previous.description=Previous console history entry +action.Console.History.Next.text=Next +action.Console.History.Next.description=Next console history entry +action.Console.History.Browse.text=Browse History +action.Console.History.Browse.description=Browse console history +action.Console.History.BrowseTW.text=Browse History +action.Console.History.BrowseTW.description=Browse console history diff --git a/platform/platform-resources/src/idea/Keymap_Default.xml b/platform/platform-resources/src/idea/Keymap_Default.xml index ab1d1c0a4c27..c3fe8be6cc4e 100644 --- a/platform/platform-resources/src/idea/Keymap_Default.xml +++ b/platform/platform-resources/src/idea/Keymap_Default.xml @@ -908,6 +908,7 @@ + diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 874a0939cc59..72e26190e94c 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -432,11 +432,12 @@ - + - - - + + + +