• Home
  • Events
  • About
  • IDEA X for the Grails Developer

    The new version of IntelliJ IDEA was released last week. I already blogged what IDEA X means for Groovy developers, and all of those features are obviously available to any Community Edition user (that’s the free one). This post looks at all the new Grails features available in the Ultimate Edition (the one you pay for). These features are a little harder for me to try out personally as my current project is EJB3 and not Grails (someone save me please!). I’ve tried quite a few of them personally, but feedback is always welcome in case I miss or exaggerate something. Without further ado:

    Grails Aware IDE Features

    Better MVC Rename Refactoring – Related artifacts are now renamed together, such as renaming a view when renaming a controller action, or renaming test cases when the main class changes (IDEA-45378).

    Functional-Test Plugin Support – The Functional-Test plugin got some love, and support is the same as normal unit and integration tests (IDEA-51853). Testing is good.

    Filter Support – There is a new action to easily create filters, code completion of actions and controllers works within the filter mapping code, and method like render() and getRequests() resolve from the filter body (IDEA-60331 and IDEA-60167).

    Mapping DSL Support – In domain class mappings you now get code completion that is aware of HibernateMappingBuilder, and the rename refactoring is aware of the mappings (IDEA-49089.

    Constraint DSL Support – Domain object constraints definitions now have code completion on common constraint names, completion on field names, and is correctly updated when using the Rename refacotring (IDEA-49115).

    Service and Bean Inference – The names and types of services and beans can be inferred in controllers and other artifacts (IDEA-49111 and IDEA-45610).

    GSP and View Improvements

    Easy Internationalization – I love this. There’s a new intention in GSP files to move a static string into a message bundle. Alt+Enter does the trick. IDEA-44846 and IDEA-59519

    Groovy Inspection Support – In the past, only some Groovy inspections worked in GSP files. Support for more of the inspections have been added, like “divide by zero”, “double negation”, and “unresolved expression”. It’s not clear if all inspections are supported, but at least more are IDEA-50414

    Better Variable Resolution – References to controllers and controller properties are now resolved within GSP view pages. I assume this means at least control click navigation and code completion. See IDEA-49731 and IDEA-48692. Also, release notes claim “Completion for value of action/controller parameters in built-in methods redirect(), render(), forward(), chain()”.

    g:fieldValue Support – g:fieldValue tags reference a field. Rename, completion, and find usages should all now work within the tag. IDEA-60858

    Debugging in GSP – Release notes claim “Preliminary debugging of GSP pages”. Not 100% sure what this means in practice.

    JavaScript in Tags – Release notes claim “support javascript in tags like “onSuccess”, “onFailure”, etc”. Again, I’m not sure what this means in practice.

    Find Usages

    Domain class fields – Find usages for domain class fields has been improved. The ticket indicates that usages of fields within GORM dynamic queries are now supported (IDEA-58025).

    Variables from tags – Find usage support for variables defined using a g:set tag within a GSP (IDEA-58185).

    Property Usages – i18n message properties are now included in Find Usages, and the corresponding “unused property” inspections should be working (IDEA-52117).

    Even More Code Completion – Besides what’s already been mentioned, we also have…

    Model Aware GSPs – Related to above, views are now aware of which model is returned from the controller, and autocomplete works for them. More info at IDEA-40926

    Variable Aware GSPs – When you define a variable in a GSP then IDEA now autocompletes it and stops pestering you for missing imports IDEA-50257

    Attribute Aware GSPs – Finally, code completion and navigation exists for the standard attributes: “action”, “controller”, “template”, “contextPath”, “plugin”, and well as variables defined in tags like g:each, g:set, etc.

    And more, and more, and more – There’s practically too many to list. Code completion works in type convertors, in named queries, in URL Mappings and their GSP attribute values, in scope objects like servletContext, session, request, params, and flash (they also appear in the debugger as well), in views references from ‘render’ and ‘redirect’ controller calls, and in hasOne mappings which was missed in the last release.

    Grails Framework Support

    Gant Script Support – IDEA is now aware than .groovy files in the scripts directory are Gant scripts. Targets are completed and imports are resolved better (IDEA-49738).

    Grails Target History – Running a Grails target brings up a dialog box. You can now use up and down arrow to scroll through your history (IDEA-46943).

    Ivy Integration – IDEA reads your Ivy cache and automatically loads source and javadoc jars if they’re available (IDEA-53294).

    UI Improvements – The “Browse to http://localhost:8080/xxx” message in the console now lets you click it to open a browser (IDEA-47166), the test console allows keyboard input in case your tests read from standard input (IDEA-57035), the gutter of controller actions show an icon that lets you jump to the corresponding view (IDEA-49320, and the “New” menu now has context sensitive sorting (IDEA-49086). How’s that for productivity boosting?

    I believe that covers it. If you want a free IDEA Ultimate license then there are ways to get them… speaking at your local Java/Groovy Users Group is usually the easiest, and many JUGs have giveaways if you feel lucky. If your group isn’t sponsored by JetBrains then you can always ask: email jugs@jetbrains.com!

    Happy Holidays everyone. I’m hoping Santa brings IDEA 10.1.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • email
    • Print
    • Twitter
    • LinkedIn
    • XING
    • Facebook
    • Google Bookmarks

    1 Comment »

    1. Hamlet said,

      December 23, 2010 @ 13:09

      If this post doesn’t make it into Bert’s “This Week in Grails” blog then I GIVE UP!

    RSS feed for comments on this post · TrackBack URI

    Leave a Comment

    Time limit is exhausted. Please reload the CAPTCHA.

    css.php