Sunday Jan 06, 2013

Apache Camel Endpoints for Annotated Code Completion Sources

Olivier Schmitt from the French Ministry of Agriculture has forked and enhanced the code I recently blogged about for creating annotations for generating code completion support for NetBeans-based editors.

His fork is here:

https://github.com/olivier-schmitt/netbeans-poc/tree/master/completion/xhtml/annotated/CompletionRegistrationSupport

He reports that "the new thing is about telling the completion provider registration layer what is 'source' for completion items. My idea is to use URI 'a la Apache Camel' to declare item provider sources:"

@AttributeCompletionRegistrations({
   
    @AttributeCompletionRegistration(
        id = "jee-architect-cookbook-netbeans-iso6391-LanguageAttributeCompletionProvider",
        attribute = "lang",
        iconBase = "jee/architect/cookbook/netbeans/iso6391/bubble.png",
        content = "csv:jee/architect/cookbook/netbeans/iso6391/ISO6391.csv"),
   
    @AttributeCompletionRegistration(
        id = "jee-architect-cookbook-netbeans-iso6391-CountriesAttributeCompletionProvider",
        attribute = "accesskey",
        iconBase = "jee/architect/cookbook/netbeans/iso6391/bubble.png",
        content = "rest:http://api.worldbank.org/country?format=json"),
    
    @AttributeCompletionRegistration(
        id = "jee-architect-cookbook-netbeans-iso6391-BlaAttributeCompletionProvider",
        attribute = "bla",
        iconBase = "jee/architect/cookbook/netbeans/iso6391/bubble.png",
        content = "raw:tom,dick,harry"),
    
    @AttributeCompletionRegistration(
        id = "jee-architect-cookbook-netbeans-iso6391-CountriesAttributeCompletionProvider",
        attribute = "bla2",
        iconBase = "jee/architect/cookbook/netbeans/iso6391/bubble.png",
        content = "bean:jee.architect.cookbook.netbeans.iso6391.Bla2CompletionItemProvider") 
})
package jee.architect.cookbook.netbeans.iso6391;

import org.netbeans.spi.editor.completion.xhtml.api.AttributeCompletionRegistration;
import org.netbeans.spi.editor.completion.xhtml.api.AttributeCompletionRegistrations;

Source of the above:

https://github.com/olivier-schmitt/netbeans-poc/blob/master/completion/xhtml/annotated/CompletionRegistrationSupport/iso6391-sample/src/jee/architect/cookbook/netbeans/iso6391/package-info.java

Olivier says that he thinks "there should be a strong separation between UI artifacts and source provider artifacts. So, the content URI just tells how to get items and not how to render them."

Sounds like a great enhancement!

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« January 2013 »
SunMonTueWedThuFriSat
  
25
26
27
30
  
       
Today