I started writing an Eclipse plugin to extend the content assist in the Eclipse WTP HTML editor with Thymeleaf processor suggestions. (This is probably only useful for those creating HTML5 files as XHTML peeps can still use the Thymeleaf DTDs.) I've finally got something that at least works for the way I use the HTML editor, so I thought I'd release it to anybody willing to try it out.
- Current version: 0.4.0
- Released: 8 Feb 2013
Minimum Requirements - Java 6
- Eclipse Indigo SR2 (3.7.2) w/ Web Tools Platform 3.3.2 (you basically have both of these if you downloaded the Eclipse IDE for Java EE Developers bundle)
Installation Download this ZIP file attached to this forum post: org.thymeleaf.extras.eclipse.repository-0.4.0-SNAPSHOT.zip Then, in Eclipse, go to Help >> Install New Software... and add the ZIP file as an archive repository. The Thymeleaf Eclipse Plugin item should appear. Select it, and follow the on-screen prompts to install the plugin.
Usage Content assist features are only available for dialects whose namespaces (with the matching prefix) are defined in your HTML files, and if that dialect has supplied some help files in their JARs. Help files for Thymeleaf's standard processors, as well as the Thymeleaf Extras modules, come bundled with this plugin, so all you have to do to get content assist support is to include the Thymeleaf namespace and prefix in your HTML file like so:
You should now start getting content assistance for all of Thymeleaf's standard processors: suggestions as you type and autocompletion of what you've entered so far if it matches only one result (both of these can be invoked manually using CTRL+SPACE), and help text when hovering over the text of a Thymeleaf processor.
Check the readme file on the GitHub page for more information.
Phew, glad to hear it works on other computers than just my own!
Regarding your questions (just copying what I wrote on the GitHub issue for this), the processor suggestions are currently hard-coded in XML files bundled with the plugin, so I'd have to write some new files for each new dialect I want to support. There must be a better way to do this, but given this is my first ever Eclipse plugin, I'm still exploring the ways to do this. (Right now I'm wondering if there's a way to scan the project you're currently working on for dialects and load them.)
Just uploaded a new version which now works on Java 6 / Eclipse 3.7.2, and has some help/documentation text for what I consider the 'main' Thymeleaf processors (those which don't just set an existing HTML attribute, because there are lot of those!).
Original post updated to reflect these changes and with a link to the new plugin JAR.
Awesome job on the Eclipse plugin Emanuel. I just opened a new enhancement on GitHub for a feature request. It would be great to have some kind of "Thymeleaf Explorer" view in Eclipse. This could be a separate view and/or node in the existing Eclipse project explorer. See Spring's "Spring Elements" implementation as a reference. This would make it nice to easily get to Thymeleaf templates, fragments, etc....
This is also the last version before I move to a 'stable' release, which will put this plugin in line with the Thymeleaf extras versioning scheme, bumping the version number to 2.0.0. When that happens, the plugin will be downloadable through Thymeleaf's SourceForge page instead of this forum thread. I'm still thinking through options for an Eclipse update site... somewhere.
sparty02: the Thymeleaf Explorer feature is on the roadmap (well, there's a roadmap for this plugin in my head :) ) for after the 2.0.0 release.
Original post updated with a link to this new release.
Hi Vince, I can't seem to get any errors when attempting to import the plugin into Eclipse. I downloaded the file from SourceForge again (just to make sure I didn't accidentally upload a corrupted file), and then tried to import the plugin in several different ways using the tutorial shown on this website: http://www.vogella.com/articles/EclipseCodeAccess/article.html
I tried extracting the contents to a folder then importing the plugins from that folder, and also tried installing the plugin then importing the plugins from my Eclipse installation, but both methods worked for me. I wasn't asked for a password when unzipping the file either (I use WinZip).
Are you importing the plugin in a different way? Maybe your download is somehow corrupted, in which case could you try downloading the ZIP file again?
So, I'm unable to get this plugin to install myself. I'm using STS 3.1 which is riding on Eclipse 3.8.x. I kind of assumed it would work on this but doesn't appear to. Anyway, people getting failures may need to check their eclipse version
That's a good idea: I've only tested on Eclipse 3.7.2 and 4.2.x. I also thought that it should work with 3.8 versions since it's in between, but I'll download Eclipse 3.8 as well to make sure I'm not missing anything there. I've also got STS 3.1 in my 4.2 install.
Does any error show up when you try to install it? I hope I'll get it too when I download 3.8, but I'm just wondering what to look out for.
Unfortunately, I wasn't able to get any errors installing the plugin with Eclipse 3.8 :|
I tried all sorts of combinations of the following:
- Eclipse 3.8.1 SDK, 32 and 64-bit editions
- Java 6 and 7 JDKs, both 32 and 64-bit editions
And took the following steps:
- Install WTP into a fresh install of Eclipse
- Install STS next
- Install the Thymeleaf plugin next
As some last resorts, are you able to confirm the MD5/SHA1 hashes of the file you downloaded against what SourceForge has:
(When I usually have trouble installing from a plugin ZIP, I try the update site instead (or vice versa), eg: I just upgraded to Juno SR2 over the weekend, so reinstalled my usual plugins, one of which is the C++ Development Tools. I tried installing the new CDT from the update site yesterday, and that failed for some strange reason, so I downloaded the ZIP version of the repository and that went fine.)