Code Completion CTRL+RETURN

Post a reply

:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review

Expand view Topic review: Code Completion CTRL+RETURN

Re: Code Completion CTRL+RETURN

Post by Georg Raffer » Mon Oct 15, 2012 6:44 am

Hi Robert,
Thank you the solution works perfectly well for me.

bye, Georg

Re: Code Completion CTRL+RETURN

Post 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();

int ctrl = textArea.getToolkit().getMenuShortcutKeyMask();
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, ctrl), "executeStatements");
am.put("executeStatements", new ExecuteStatementsAction());

Code Completion CTRL+RETURN

Post by Georg Raffer » Fri Oct 12, 2012 6:14 am

I am using the RSyntaxTextArea + code completion. The application is used to execute HQL statements.
The code completion works fine. For executing statements I use an ActionListener which listens on CTRL+RETURN.

But when I press CTRL+RETURN the code completion always tries to complete the current text.
from KiCOHeader;

cursor is after Ki an I press CTRL+RETURN, code completion always changes the statement to KiPhysicalStockCOHeader.
But code completion is registered to CTRL+' ':

AutoCompletion ac = new AutoCompletion(provider);
ac.setTriggerKey(KeyStroke.getKeyStroke(' ', InputEvent.CTRL_DOWN_MASK));

Can anybody please explain how the auto completion for CTRL+RETURN can be disabled?

bye, Georg