<< June 2007 | Home | August 2007 >>

Grails Navigation Actions for Eclipse

My poor little computer was at the receiving end of uncharacteristic cursing. This happens when my 'flow' is interrupted too often. Moving between domain classes, controllers and views is rather tedious in Eclipse. So yesterday I did something about it and created some navigation actions, and now I am back in my peaceful coding world.

The actions appear in the Navigation menu, as well as the popup menu in the Groovy editor:

Open Actions

The first action, 'Open Twin' toggles between domain classes and their related controller. The hot key make this very snappy.
The second action, 'Open Views' opens a dialog with a list of views related to the domain or controller class:

Open Views


In a previous entry, I described how to enable the XML editor for GSPs. If need be I will add more actions to get from GSPs back to their related controller classes.

This is not part of the official GroovyEclipse plugin. I don't know where it fits it - it should be part of GrailsEclipse, but I don't know anything about it. I will have to ask James how that is coming along.

Until then, I created an update site at http://www.rippleinteractive.com/update from which to install the plugin. And if anyone wants to poke around, here is the source.
I'd be curious to know if it works in Windows, I didn't think too hard about path separators.

Have fun.

Editing GSPs in Eclipse

The Eclipse XML editor works nicely with GSPs. It's not a GSP editor, but it does a few nice things:
  • Command+Shift+F formats
  • Opening tag completion for html elements, and closing tag completion for any element including taglib elements
  • Syntax highlighting
  • Structure error markers
It doesn't however work out of the box. To get it working:
  1. Window->Preferences
  2. Search for 'Content Types'. In the list navigate to Text->XML
  3. Add '*.gsp' to the file associations list
That's it - happy GSP editing. I wonder how difficult it would be to extend the XML editor to be Groovy/Grails aware?