Tuesday, February 16, 2010

JBoss Tools Eclipse plugin content assist lessons

I learned a couple lessons in the process of making JBoss Tools Eclipse plug-in to do content assist (where you type ctrl-space to get code suggestions). This is mostly about JSF component libraries.

First of all, in order to get content assist for JSF components, you must have the TLD file in your class path. We are using Richfaces libraries, and all its components get content assist. The ones I had trouble with are jsf-core and jsf-html, the f: and h: tags by default. Oddly enough though, with all the JSF libraries I have on my class path, none of them had packaged the TLDs for these two. I made a jar file and put jsf-core.tld and jsf-html.tld in the META-INF folder to get this working.

Another lesson learned is that the name space URI has to match exactly with the TLD's. I mean exactly. Kind of obvious, but easy to miss when trouble shooting. I added Openfaces like this xmlns:o="http://openfaces.org" in the first place and it didn't work, because it is expecting a "/" at the end. So the correct syntax is xmlns:o="http://openfaces.org/"

3 comments:

Max said...

Yes we moved to drive contentassist from classpath lately. Before we had some static metadata for specific libraries which made it always work but might would be wrong if you use an newer or older version of the lib that we had made static metadata for.

So in cr1 we went all dynamic but quickly learned from feedback that useres aren't used to have all tlds on the classpath especially for the common ones.

Thus we quickly after cr1 added the fallback to use the xcatalog system in eclipse to lookup static schemas. So try that out - should be easier :)

about the *exact* matching I would say we could fix this. At least for your case where the canonical URL are equivalent. Please report it in jira as a feature request with a sample of what caused your troubles. Thanks!

Alex Zhang said...

Max, Thanks for the comments. I will update to the lastest candidate and try it out again.

About the second item, I am not sure if it should be changed. Coming from the Linux world, I totally understand that "something" and "something/" are two different things (learned the hard way from using rsync).

Anyhow, it is really nice to know that you guys are so active.

Max said...

Well we could at least put a squigly line under it telling you it might not be what you are looking for ;)