Extension point for providing custom content assist processors in Eclipse

旧巷老猫 提交于 2019-12-05 03:44:52

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.

You can do it by declaring an extension to:

org.eclipse.jdt.ui.javaCompletionProposalComputer

Here is the reference page to start with.

You can find a demo project here

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.

If properties files can follow an EBNF grammar, then you could give Eclipse Xtext a shot

Xtext is a framework for development of textual domain specific languages (DSLs).
Just describe your very own DSL using Xtext's simple EBNF grammar language and the generator will create a parser, an AST-meta model (implemented in EMF) as well as a full-featured Eclipse text editor from that.

alt text http://www.eclipse.org/Xtext/images/screenshot-title.png

The Framework integrates with technology from Eclipse Modeling such as EMF, GMF, M2T and parts of EMFT.
Development with Xtext is optimized for short turn-arounds, so that adding new features to an existing DSL is a matter of minutes. Still sophisticated programming languages can be implemented.


Otherwise, you can find some example of content assist in this thread, or this one (JSDT -- JavaScript)

Peter Štibraný

Looks like IContentProposalProvider may be what I am looking for, but still no extension point.

See this: http://www.vogella.de/articles/RichClientPlatform/article.html#fieldassist

This is not extension based solution, but may still benefit you.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!