mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[peter] IDEA-69028 'Recent Files' problems with database console
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 768 B |
@@ -118,6 +118,7 @@ public class ConsoleHistoryController {
|
||||
EmptyAction.setupAction(myHistoryPrev, "Console.History.Previous", null);
|
||||
EmptyAction.setupAction(myBrowseHistory, "Console.History.Browse", null);
|
||||
if (!myMultiline) {
|
||||
EmptyAction.setupAction(myBrowseHistory, "Console.History.BrowseTW", null);
|
||||
myHistoryNext.registerCustomShortcutSet(KeyEvent.VK_UP, 0, null);
|
||||
myHistoryPrev.registerCustomShortcutSet(KeyEvent.VK_DOWN, 0, null);
|
||||
}
|
||||
@@ -285,7 +286,7 @@ public class ConsoleHistoryController {
|
||||
}
|
||||
|
||||
private void saveHistory(final XmlSerializer out) throws IOException {
|
||||
out.startDocument("UTF-8", null);
|
||||
out.startDocument(CharsetToolkit.UTF8, null);
|
||||
out.startTag(null, "console-history");
|
||||
out.attribute(null, "id", myId);
|
||||
for (String s : myModel.getHistory()) {
|
||||
|
||||
@@ -73,7 +73,6 @@ import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -241,7 +240,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
for (AnAction action : createActions()) {
|
||||
action.registerCustomShortcutSet(action.getShortcutSet(), myConsoleEditor.getComponent());
|
||||
}
|
||||
registerActionShortcuts(myHistoryViewer.getComponent());
|
||||
EmptyAction.registerActionShortcuts(myHistoryViewer.getComponent(), myConsoleEditor.getComponent());
|
||||
}
|
||||
|
||||
protected AnAction[] createActions() {
|
||||
@@ -516,7 +515,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
for (FileEditor fileEditor : source.getAllEditors(file)) {
|
||||
if (!(fileEditor instanceof TextEditor)) continue;
|
||||
final Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
registerActionShortcuts(editor.getComponent());
|
||||
EmptyAction.registerActionShortcuts(editor.getComponent(), myConsoleEditor.getComponent());
|
||||
editor.getCaretModel().addCaretListener(new CaretListener() {
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
queueUiUpdate(false);
|
||||
@@ -536,16 +535,6 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
});
|
||||
}
|
||||
|
||||
protected void registerActionShortcuts(JComponent component) {
|
||||
final ArrayList<AnAction> actionList =
|
||||
(ArrayList<AnAction>)myConsoleEditor.getComponent().getClientProperty(AnAction.ourClientProperty);
|
||||
if (actionList != null) {
|
||||
for (AnAction anAction : actionList) {
|
||||
anAction.registerCustomShortcutSet(anAction.getShortcutSet(), component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Editor getCurrentEditor() {
|
||||
return myCurrentEditor;
|
||||
}
|
||||
|
||||
@@ -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<AnAction> actionList =
|
||||
(ArrayList<AnAction>)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() {
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -908,6 +908,7 @@
|
||||
|
||||
<action id="Console.History.Next"><keyboard-shortcut first-keystroke="control UP"/></action>
|
||||
<action id="Console.History.Previous"><keyboard-shortcut first-keystroke="control DOWN"/></action>
|
||||
<action id="Console.History.Browse"><keyboard-shortcut first-keystroke="control alt E"/></action>
|
||||
|
||||
<action id="Console.Jdbc.Execute"><keyboard-shortcut first-keystroke="control ENTER"/></action>
|
||||
<action id="Console.Jdbc.Properties"><keyboard-shortcut first-keystroke="control alt ENTER"/></action>
|
||||
|
||||
@@ -432,11 +432,12 @@
|
||||
<action id="ShowRegistry" class="com.intellij.openapi.util.registry.ShowRegistryAction"/>
|
||||
</group>
|
||||
|
||||
<action id="Console.Execute" class="com.intellij.openapi.actionSystem.EmptyAction" text="Execute Current Statement"/>
|
||||
<action id="Console.Execute" class="com.intellij.openapi.actionSystem.EmptyAction"/>
|
||||
<group id="Console.HistoryActions">
|
||||
<action id="Console.History.Previous" class="com.intellij.openapi.actionSystem.EmptyAction" text="Previous"/>
|
||||
<action id="Console.History.Next" class="com.intellij.openapi.actionSystem.EmptyAction" text="Next"/>
|
||||
<action id="Console.History.Browse" class="com.intellij.openapi.actionSystem.EmptyAction" text="Browse" use-shortcut-of="RecentFiles"/>
|
||||
<action id="Console.History.Previous" class="com.intellij.openapi.actionSystem.EmptyAction"/>
|
||||
<action id="Console.History.Next" class="com.intellij.openapi.actionSystem.EmptyAction"/>
|
||||
<action id="Console.History.Browse" class="com.intellij.openapi.actionSystem.EmptyAction" icon="/actions/consoleHistory.png"/>
|
||||
<action id="Console.History.BrowseTW" class="com.intellij.openapi.actionSystem.EmptyAction" use-shortcut-of="RecentFiles" icon="/actions/consoleHistory.png"/>
|
||||
</group>
|
||||
|
||||
<group id="Internal" text="Internal Actions" internal="true" popup="true">
|
||||
|
||||
Reference in New Issue
Block a user