Friday, November 27, 2009

New cross-language refactoring support for Groovy-Eclipse plugin

Thanks to the work of Michael Klenk and his students at the Institute for Software in Switzerland, the Groovy-Eclipse plugin now has cross-language refactoring support for renaming. Its use is seamless. Let me give you an example.

Let's start with a simple Java file and a simple Groovy file:

before

You can rename the field in the Java class:

during1

This will perform the standard Java refactoring on all Java classes in your projects. Additionally, the refactoring will be performed on your groovy classes. If there are any ambiguous references to the Java field, the following dialog will open up allowing you to choose which references should be refactored:

choose

And the result is what you would expect:

after

The refactoring can be initiated from the Groovy side as well:

groovyrefactor_menu

As you can see, extract method an inline method are two other refactorings supported in Groovy code.

This functionality is currently available in the latest snapshot build of Groovy-Eclipse for Eclipse 3.5, available from the following update site:
   http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.5/


Please send any questions or problems to the mailing list. We're happy to help. Enjoy!

No comments:

Post a Comment

Post a Comment