コミットメタ情報

リビジョン0b10310e228ecd89ca98abc928b76fb597cc5da7 (tree)
日時2014-11-22 22:07:28
作者argius <argius.net@gmai...>
コミッターargius

ログメッセージ

[#34600] add a new function "show all histories" into GUI menu

変更サマリ

差分

--- a/src/net/argius/stew/ui/window/AnyActionKey.java
+++ b/src/net/argius/stew/ui/window/AnyActionKey.java
@@ -32,6 +32,7 @@ public enum AnyActionKey {
3232 breakCommand,
3333 lastHistory,
3434 nextHistory,
35+ showAllHistories,
3536 sendRollback,
3637 sendCommit,
3738 connect,
--- a/src/net/argius/stew/ui/window/ConsoleTextArea.java
+++ b/src/net/argius/stew/ui/window/ConsoleTextArea.java
@@ -161,6 +161,17 @@ final class ConsoleTextArea extends JTextArea implements AnyActionListener, Text
161161 }
162162
163163 /**
164+ * Prepares submitting.
165+ * Clears selection, moves cursor to end, and focuses this.
166+ */
167+ void prepareSubmitting() {
168+ final int ep = getEndPosition();
169+ setSelectionStart(ep);
170+ moveCaretPosition(ep);
171+ requestFocus();
172+ }
173+
174+ /**
164175 * Clears text.
165176 */
166177 void clear() {
--- a/src/net/argius/stew/ui/window/Menu.u8p
+++ b/src/net/argius/stew/ui/window/Menu.u8p
@@ -73,7 +73,7 @@ item.autoAdjustModeHeaderAndValue.checkbox=yes
7373
7474 group.command=Command
7575 group.command.mnemonic=C
76-group.command.items=executeCommand,breakCommand,,lastHistory,nextHistory,sendRollback,sendCommit,,connect,disconnect,,postProcessMode,inputEcryptionKey,editConnectors
76+group.command.items=executeCommand,breakCommand,,lastHistory,nextHistory,showAllHistories,sendRollback,sendCommit,,connect,disconnect,,postProcessMode,inputEcryptionKey,editConnectors
7777 item.executeCommand=Execute
7878 item.executeCommand.mnemonic=X
7979 item.executeCommand.shortcut=ctrl M
@@ -86,6 +86,8 @@ item.lastHistory.shortcut=ctrl UP
8686 item.nextHistory=History Next
8787 item.nextHistory.mnemonic=N
8888 item.nextHistory.shortcut=ctrl DOWN
89+item.showAllHistories=Show All Histories
90+item.showAllHistories.mnemonic=A
8991 item.sendRollback=Rollback
9092 item.sendRollback.mnemonic=R
9193 item.sendCommit=Commit
--- a/src/net/argius/stew/ui/window/Menu_ja.u8p
+++ b/src/net/argius/stew/ui/window/Menu_ja.u8p
@@ -30,6 +30,7 @@ item.executeCommand=実行
3030 item.breakCommand=中断
3131 item.lastHistory=前のコマンド履歴
3232 item.nextHistory=次のコマンド履歴
33+item.showAllHistories=コマンド履歴を全表示
3334 item.sendRollback=ロールバック
3435 item.sendCommit=コミット
3536 item.connect=接続
--- a/src/net/argius/stew/ui/window/WindowLauncher.java
+++ b/src/net/argius/stew/ui/window/WindowLauncher.java
@@ -298,6 +298,18 @@ public final class WindowLauncher implements
298298 retrieveHistory(-1);
299299 } else if (ev.isAnyOf(nextHistory)) {
300300 retrieveHistory(+1);
301+ } else if (ev.isAnyOf(showAllHistories)) {
302+ if (historyList.isEmpty()) {
303+ op.showInformationMessageDialog(res.get("w.no-histories"), null);
304+ } else {
305+ final String msg = res.get("i.choose-history", historyList.size());
306+ final String lastCommand = historyList.get(historyList.size() - 1);
307+ Object value = op.showInputDialog(msg, null, historyList.toArray(), lastCommand);
308+ if (value != null) {
309+ textArea.replace((String)value);
310+ textArea.prepareSubmitting();
311+ }
312+ }
301313 } else if (ev.isAnyOf(sendRollback)) {
302314 if (confirmCommitable()
303315 && showConfirmDialog(op, res.get("i.confirm-rollback"), null, OK_CANCEL_OPTION) == OK_OPTION) {
@@ -652,10 +664,7 @@ public final class WindowLauncher implements
652664 historyIndex = historyList.size() - 1;
653665 }
654666 textArea.replace(historyList.get(historyIndex));
655- final int endPosition = textArea.getEndPosition();
656- textArea.setSelectionStart(endPosition);
657- textArea.moveCaretPosition(endPosition);
658- textArea.requestFocus();
667+ textArea.prepareSubmitting();
659668 }
660669
661670 /**
--- a/src/net/argius/stew/ui/window/WindowOutputProcessor.java
+++ b/src/net/argius/stew/ui/window/WindowOutputProcessor.java
@@ -402,6 +402,36 @@ final class WindowOutputProcessor extends JFrame implements OutputProcessor, Any
402402 currentDirectory = dir;
403403 }
404404
405+ Object showInputDialog(String message, String title, Object[] values, Object initial) {
406+ return showInputDialog(this, message, title, values, initial);
407+ }
408+
409+ static Object showInputDialog(Component parent, String message, String title, Object[] values, Object initial) {
410+ JOptionPane p = new JOptionPane(message, PLAIN_MESSAGE, OK_CANCEL_OPTION);
411+ p.setWantsInput(true);
412+ p.setSelectionValues(values);
413+ p.setInitialSelectionValue(initial);
414+ p.setComponentOrientation(parent.getComponentOrientation());
415+ JDialog d = p.createDialog(parent, title);
416+ Dimension size = d.getSize();
417+ if (size.width > parent.getWidth() || size.height > parent.getHeight()) {
418+ if (size.width > parent.getWidth()) {
419+ size.width = (int)(parent.getWidth() * 0.95);
420+ }
421+ if (size.height > parent.getHeight()) {
422+ size.height = (int)(parent.getHeight() * 0.95);
423+ }
424+ d.setPreferredSize(size);
425+ d.setSize(size);
426+ d.setLocationRelativeTo(parent);
427+ }
428+ p.selectInitialValue();
429+ d.setVisible(true);
430+ d.dispose();
431+ Object value = p.getInputValue();
432+ return (value == UNINITIALIZED_VALUE) ? null : value;
433+ }
434+
405435 void showInformationMessageDialog(String message, String title) {
406436 showInformationMessageDialog(this, message, title);
407437 }
--- a/src/net/argius/stew/ui/window/messages.u8p
+++ b/src/net/argius/stew/ui/window/messages.u8p
@@ -1,5 +1,6 @@
11 i.cancelled=The command was canceled.\n(The process in the server-side may be still working.)
22 i.choose-connection=Choose Connector
3+i.choose-history=Choose a command history of {0} histories
34 i.confirm-close=Do you want to close this window?
45 i.confirm-commit=Do you want to commit?
56 i.confirm-overwrite=The file [{0}] already exists. Overwrite it?
@@ -19,6 +20,7 @@ i.statusbar-message=\ Execution Time {0} seconds ( {1} )
1920 w.connector-readonly=This connector is read-only.
2021 w.import-target-not-available=The destination to import is not available.
2122 w.no-connector=No Connector.
23+w.no-histories=No command histories.
2224 w.not-connect=Not connected.
2325 e.cannot-open-help-automatically=Can't open help({0}) automatically on this platform.
2426 e.enables-select-just-1-table=You can choose only one of tables.
--- a/src/net/argius/stew/ui/window/messages_ja.u8p
+++ b/src/net/argius/stew/ui/window/messages_ja.u8p
@@ -1,5 +1,6 @@
11 i.cancelled=コマンドがキャンセルされました。\n(サーバ側の処理はキャンセルされていません。)
22 i.choose-connection=接続を選択
3+i.choose-history=コマンド履歴{0}件からコマンドを選択
34 i.confirm-close=ウィンドウを閉じてよろしいですか?
45 i.confirm-commit=コミットします。よろしいですか?
56 i.confirm-overwrite=ファイル {0} は存在します。\n上書きしますか?
@@ -19,6 +20,7 @@ i.statusbar-message=\ 実行時間 {0} 秒 ( {1} )
1920 w.connector-readonly=コネクタは読取専用です。
2021 w.import-target-not-available=インポート先が無効です。
2122 w.no-connector=接続設定がありません。
23+w.no-histories=コマンド履歴がありません。
2224 w.not-connect=接続されていません。
2325 e.cannot-open-help-automatically=このプラットフォームでは自動でヘルプ({0})を開けません。
2426 e.enables-select-just-1-table=テーブルは1つだけ選択できます。
旧リポジトリブラウザで表示