Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extension point for providing custom content assist processors in Eclipse

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.

like image 346
Peter Štibraný Avatar asked Dec 30 '09 20:12

Peter Štibraný


People also ask

What is an extension point in Eclipse?

Extensions and extension points. Eclipse provides the concept of extensions to contribute functionality to a certain type of API. The type of API is defined by a plug-in via an extension point . Extensions can be contribute by one or more plug-ins.

How to add a client to a custom extension point?

Switch to the Extensions tab and select Add…​ . Select your custom extension point and press the Finish button. Add a client to your extension point via right-click. Create the GreeterGerman class with the following code.

What is content assist in a text editor?

Within an editor, content assist helps reduce the characters typed by providing a context sensitive list of possible completions to the characters already typed. The context assist can be invoked by clicking Ctrl + Space.

What is an extension point plug-in?

The plug-in which defines the extension point is also responsible for evaluating the extensions. Therefore, it typically contains the necessary code to do that. This plug-in provides an extension (contribution) based on the contract defined by an existing extension point. Contributions can be code or data. 3. Creating an extension point


2 Answers

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

like image 72
Andrea Salicetti Avatar answered Sep 19 '22 18:09

Andrea Salicetti


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.

like image 28
David Green Avatar answered Sep 19 '22 18:09

David Green