用于在 Eclipse 中提供自定义内容辅助处理器的扩展点
我正在编写 eclipse 插件来添加对属性文件的更好支持。缺少的部分之一是内容辅助...我想在用户开始输入一些字符串并按下内容辅助键时显示匹配的属性键。
例如,当我的一个属性文件中有属性 hello = world
时,我开始输入 format("hel
并点击 CTRL+ SPACE 现在,我想查看可用的 hello
属性
我的问题是我找不到正确的扩展点来提供自定义内容辅助处理器,我如何提供自己的内容。文本文件的内容辅助处理器?我想让它主要在 Java、JSP 和 XML 文件中工作。
I am writing eclipse plugin to add better support for properties files. One of the missing piece is content-assist ... I'd like to show matching properties keys when user starts typing some string and presses content assist key.
For example, when I have property hello = world
in one of my properties files, and I start typing format("hel
and hit CTRL+SPACE now, I'd like to see available hello
property.
My problem is that I cannot find correct extension point to provide custom content assist processor. How can I provide my own content assist processor for text files? I'd like to make it work mainly in Java, JSP and XML files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可以通过声明扩展来实现:
这是 参考页面开始。
您可以找到一个演示项目 这里
You can do it by declaring an extension to:
Here is the reference page to start with.
You can find a demo project here
我之前也曾寻找过这样的扩展点,但没有成功。据我所知,不可能以这种方式向 Eclipse 中的编辑器添加新类型的内容辅助。
I've looked for such an extension point before with no success. As far as I know it's not possible to add new types of content assist to editors in Eclipse in this way.
您可以创建一个插件项目,选项“带有编辑器的插件”,有一个带有语法着色的小型 XML 语言编辑器(此类将帮助您了解扩展的类)。未使用内容辅助,但您可以添加它,查看常见问题
解答语法着色
http:// help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Feditors_highlighting.htm
内容助理
http:// help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Feditors_contentassist.htm
我想要找到的唯一内容是将 JavaDoc 之类的信息添加到已定义助理的提案。 FAQ里说了一些但是我真的不明白。
希望有帮助。
You can create a plug-in project, the option, "plug-in with an editor", there is a small XML language editor with syntax coloring (this class will help you to know the classes for the extension). The content assist is not used, but you can add it looking this FAQs
Syntax coloring
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Feditors_highlighting.htm
Content Assitant
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Feditors_contentassist.htm
The only thing that I am trying to find is the add Information like JavaDoc to the proposal for the defined assistant. In the FAQ say something but I really don't understand it.
Hope it helps.
如果属性文件可以遵循 EBNF 语法,那么你可以给 Eclipse Xtext 一个镜头
替代文本 http://www.eclipse.org/Xtext/images/screenshot-标题.png
否则,您可以在此线程,或这个(JSDT - JavaScript )
If properties files can follow an EBNF grammar, then you could give Eclipse Xtext a shot
alt text http://www.eclipse.org/Xtext/images/screenshot-title.png
Otherwise, you can find some example of content assist in this thread, or this one (JSDT -- JavaScript)
看起来 IContentProposalProvider 可能是我正在寻找的,但仍然没有扩展点。
Looks like IContentProposalProvider may be what I am looking for, but still no extension point.
请参阅:http://www.vogella.de/articles/RichClientPlatform/article .html#fieldassist
这不是基于扩展的解决方案,但可能仍然对您有益。
See this: http://www.vogella.de/articles/RichClientPlatform/article.html#fieldassist
This is not extension based solution, but may still benefit you.
看一下
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.wst.doc.isv/html/plugin_descriptions_WST/wst.html
了解 wst xml 编辑器的想法以及可能的其他类型的编辑器
Have a look at
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.wst.doc.isv/html/plugin_descriptions_WST/wst.html
for ideas for the wst xml editor and potentially other types of editors