如何在自定义 Eclipse 插件中访问默认的 JDT 完成建议?
我正在编写一个 Eclipse 插件,它具有自动完成功能(当您按 Ctrl+Space 时)。 一般来说,我知道它是如何工作的,我完成了我自己的提案。
但问题是,我的老板希望我完成与 Eclipse 中相同的工作。例如,如果我输入“Str”或“org”并按 Ctrl+Space,我希望获得 Java 的补全列表,例如“Str”a “String”,代表“org”“org.eclipse....”+一个长列表。因此,我需要计算包和类的建议,就像在 Eclipse 的 JDT 编辑器中一样。
我知道这可能听起来很愚蠢,使其与现有的相同,但我需要这个解决方案。
之前有人做过类似的事情吗?我需要实现哪个类?我需要进行哪些更改(plugin.xml?)?
I'm writing an Eclipse plugin, that has the functionallity of auto completion (the thing when you press Ctrl+Space).
Generally, I know how it works, I made a completion for my own proposals.
But the problem is, that my boss want me to make a completion the same as is in eclipse already. For example if I type "Str", or "org" and press Ctrl+Space, I want to have a completion lists from Java, for example for "Str" a "String", for "org" "org.eclipse...." + a long list. So I need to compute proposals for packages and for classes, just like in Eclipse's JDT editor.
I know that may sound stupid, making it the same as already is, but I need this solution.
Has anyone done a similar thing earlier? Which class do I need to implement? What changes do I need to make (plugin.xml?)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试 org.eclipse.jdt.ui.text.java.CompletionProposalCollector。在类的 Javadoc 中有一个关于如何使用它的示例。
Try org.eclipse.jdt.ui.text.java.CompletionProposalCollector. There's an example on how to use it in the class' Javadoc.