如何在 Eclipse RCP 编辑器中指定内容辅助的触发键?

发布于 2024-09-27 05:47:38 字数 285 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

℉絮湮 2024-10-04 05:47:38

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文