简体   繁体   English

如何在Eclipse RCP编辑器中为内容赋值指定触发键?

[英]How to specify trigger key for content assit in Eclipse RCP editor?

There is a method getCompletionProposalAutoActivationCharacters in ContentAssistProcessor that can return characters which trigger the completion proposals. ContentAssistProcessor中有一个方法getCompletionProposalAutoActivationCharacters ,该方法可以返回触发完成建议的字符。 For example I can return new char[] { '.' } 例如,我可以return new char[] { '.' } return new char[] { '.' } so that each time I type dot in the editor the word completion proposal shows up. return new char[] { '.' }这样,每次我在编辑器中输入点时,都会显示单词完成建议。

I thought that there should be a simular way to specify shortcut key stroke to trigger content assist such as Alt + / , but actually that's different. 我认为应该有一种类似的方法来指定快捷键来触发内容帮助,例如Alt + / ,但实际上是不同的。

What is the best way to do this? 做这个的最好方式是什么? I personally don't want to hard code a key listener for this. 我个人不想为此硬编码一个关键侦听器。

JDT does that. JDT做到了。 They have a command+handler+keybinding to invoke the content assist. 它们具有Command + Handler + Keybinding来调用内容辅助。
See org.eclipse.jdt.internal.ui.text.java.JavaContentAssistHandler for the implementation. 有关实现,请参见org.eclipse.jdt.internal.ui.text.java.JavaContentAssistHandler
You can do similar one 你可以做类似的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM