Posts Tagged ‘groovy’

Grails: Quick navigation between actions and views

Tuesday, September 14th, 2010

IntelliJ Idea X adds quick navigation for Grails actions and GSP pages. Whenever an action has a same-named view, IDEA creates a gutter icon opposite to the action name. Click that icon and the corresponding page is opened:

As for going back, the GSP editor has a link to the appropriate action at the top:

Groovy/Groovy++ object creation

Thursday, August 5th, 2010

Groovy’s as keyword allows for some interesting features. In particular, it provides a convenient syntactic sugar for object creation:

Point point = [4, 2] as Point
KeyAdapter listener = [
        keyTyped: { e -> … },
        keyReleased: { e -> … }
] as KeyAdapter

Still in development, but already quite usable, there is Groovy++: a library which adds static typing, performance and much more to Groovy language. One thing you get addicted to quite soon is that you don’t have to write as in the cases above anymore. If the compiler can statically figure out the expected type, it will insert all the necessary casts for you. This works, for example, for variable declarations, method return types and even method calls. So, if you have

JComponent comp = …

you can then write

if (comp.contains([x:2, y:4])) { … }

Cool, isn’t it? But why am I writing about all this in IntelliJ IDEA blog? Well, just to boast. Unusual syntax is not a reason for not helping you in coding, right? So, now the converted list/map literals will be shown if you search for the constructor usages in IntelliJ IDEA:

And the syntax highlighting on the brackets will help you distinguish between plain list/map literals and the ones that serve for object creation:

Finally, you can easily navigate to the constructor called via a literal. Just place your caret before the opening bracket and go to the declaration (e.g. press Ctrl+B)!

All this will be available in the next IntelliJ IDEA X EAP.

Groovy stacktrace folding

Wednesday, March 17th, 2010

When you look at a typical Groovy stack trace, you usually see something like this:

This is not terribly helpful, since there are only three lines from the actual source code. Everything else refers to Groovy’s internals. From now on, though, reading Groovy stack traces will be much easier:

New String-related Intentions for Groovy

Wednesday, September 23rd, 2009

With the latest Maia EAP Groovy language support is improved with several new GStrings intention actions.

Now you can convert string concatenations to GStrings…

…and back simply by pressing Alt+Enter, Enter.

Also, IntelliJ IDEA is now aware of that braces can be skipped in some GString injections.

Groovy-related Configuration Changes

Tuesday, September 8th, 2009

The next Maia EAP brings you massive changes in Groovy, Grails, Griffon, Gant & Gradle support, mostly affecting framework configuration.

First, Grails/Griffon application options are available when you create a project or a module:

You may also choose to import an application from existing sources:

Earlier, you needed Gant & Gradle in module dependencies to run build scripts — quite awkward, because the way you are building your project should not affect its classpath. Now, we have per-project settings for Gant & Gradle:

Also, you can now write Groovy code and get full coding assistance with compilation as long as you have Groovy jars anywhere in a module classpath. Together with the new compiler Resource patterns path constraints feature (/ - path separator; /**/ - any number of directories) this made Groovy facet obsolete. So, there is no Groovy facet anymore.

You can still add any Gr8 libraries to a module via Add Framework Support context action:

Everything you’ve just read about will be available in the next EAP.

Gradle Support

Friday, August 21st, 2009

The latest Maia EAP features lightweight support for Gradle build framework. You can add Gradle library to a Groovy facet:

You can also run Gradle scripts via Ctrl+Shift+F10 in a script file:

Intelligent Groovy Coding Assistance

Tuesday, August 4th, 2009

As most of you would know, IntelliJ IDEA includes intelligent Groovy support. We have created two live demos that demonstrate how you can effectively use IntelliJ IDEA to build your Groovy applications: Transparent Groovy Assistance and Groovy Specific Support.

Initial Griffon Support

Wednesday, July 29th, 2009

The next Maia EAP brings you basic Griffon support, similar to Grails integration. You’ll be able to add Griffon library to Groovy facet:

IntelliJ IDEA will then create a Griffon application or plugin directory structure and take all the steps necessary to keep it up-to-date, as you install plugins and add libraries. As with Grails, a dedicated Griffon project view will appear together with a run/debug configuration:

Also, Run Griffon target with target autocompletion action can be found under Tools menu.

Named Parameters Completion in Groovy

Tuesday, June 9th, 2009

Groovy language support becomes a little bit better in Maia with the support for named parameters completion. Maia is now capable of displaying all named parameters ever used in method bodies.

IDEA 8.1.1: Improved Struts 2 support

Monday, April 20th, 2009

The upcoming IntelliJ IDEA version 8.1.1, currently available as Release Candidate 1 from EAP will feature a lot of small and useful improvements to its built-in Struts 2 support.

Among the others, you will find a better New Project wizard, added support for more CSS attributes from Struts’ UI-Tag Library, as well as support for new elements from Struts 2.1 DTD-based configuration files (see the complete list of changes).

Do you like to write your actions in Groovy? Now you can navigate back and forth between your Groovy-Action and struts.xml using the Struts-Gearwheel in the editor gutter bar:



Stay tuned for more improvements and new features in IntelliJ IDEA 9 (”Maia“).