by robert » Sat Oct 13, 2012 2:00 pm
Hi Georg,
Ctrl+Enter is mapped to the "dumb complete word action." This action scans the document backwards from the caret position, and "auto-completes" the word at the caret position with the most recent one starting with the same prefix. This is added in
RTADefaultInputMap. To remove this functionality, you need to either remove the DumbCompleteWordAction from the InputMap/ActionMap, or replace it with your own action to execute the HQL statements (the latter is probably cleaner). i.e.
java code:
class ExecuteStatementsAction extends AbstractAction {
...
}
...
InputMap im = textArea.getInputMap();
ActionMap am = textArea.getActionMap();
am.remove(RTextAreaEditorKit.rtaDumbCompleteWordAction);
int ctrl = textArea.getToolkit().getMenuShortcutKeyMask();
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, ctrl), "executeStatements");
am.put("executeStatements", new ExecuteStatementsAction());
Hi Georg,
Ctrl+Enter is mapped to the "dumb complete word action." This action scans the document backwards from the caret position, and "auto-completes" the word at the caret position with the most recent one starting with the same prefix. This is added in [url=http://svn.fifesoft.com/viewvc-1.0.5/bin/cgi/viewvc.cgi/RSyntaxTextArea/trunk/src/org/fife/ui/rtextarea/RTADefaultInputMap.java?view=markup&revision=425&root=RSyntaxTextArea]RTADefaultInputMap[/url]. To remove this functionality, you need to either remove the DumbCompleteWordAction from the InputMap/ActionMap, or replace it with your own action to execute the HQL statements (the latter is probably cleaner). i.e.
[code2=java]class ExecuteStatementsAction extends AbstractAction {
...
}
...
InputMap im = textArea.getInputMap();
ActionMap am = textArea.getActionMap();
am.remove(RTextAreaEditorKit.rtaDumbCompleteWordAction);
int ctrl = textArea.getToolkit().getMenuShortcutKeyMask();
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, ctrl), "executeStatements");
am.put("executeStatements", new ExecuteStatementsAction());[/code2]