如何在 Eclipse RCP 编辑器中指定内容辅助的触发键?
ContentAssistProcessor
中有一个方法 getCompletionProposalAutoActivationCharacters
,可以返回触发完成建议的字符。例如,我可以 return new char[] { '.'这样每次我在编辑器中输入点时,就会显示单词补全建议。
我认为应该有一种类似的方法来指定快捷键来触发内容辅助,例如 Alt + /
,但实际上这是不同的。
最好的方法是什么?我个人不想为此硬编码一个关键监听器。
There is a method getCompletionProposalAutoActivationCharacters
in ContentAssistProcessor
that can return characters which trigger the completion proposals. For example I can return new char[] { '.' }
so that each time I type dot in the editor the word completion proposal shows up.
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.
What is the best way to do this? I personally don't want to hard code a key listener for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JDT 就是这么做的。他们有一个命令+处理程序+键绑定来调用内容辅助。
请参阅
org.eclipse.jdt.internal.ui.text.java.JavaContentAssistHandler
用于实现。你可以做类似的一个
JDT does that. They have a command+handler+keybinding to invoke the content assist.
See
org.eclipse.jdt.internal.ui.text.java.JavaContentAssistHandler
for the implementation.You can do similar one