Author Archive

Intelligent Copy&Paste

Friday, October 2nd, 2009

Do you find yourself copying and pasting parts of bodies between different methods and then facing broken code?

Unfortunately, parameter names tend to differ — like in this (very simplified) example:

Nothing is easier than fixing this problem with a few keystrokes in IntelliJ IDEA!

First, move caret on any red reference (highlighted with red color), or simply press F2, and then invoke available Quick-Fixes via Alt+Enter:

Now select Rename Reference (again, you can use arrow keys or just start typing Ren.. + Enter) and… IntelliJ IDEA fixes code for you!

See, sometimes it’s just the small features making it possible to achieve maximum productivity.

Using Scope-Based Code Highlighting

Sunday, May 10th, 2009

One of not so well-known features of IntelliJ IDEA is an ability to differently highlight certain scopes in code editor.

To use it, open the Settings dialog, under IDE Settings expand Editor, then expand Colors & Fonts, and select Scope Based preferences. You will see a list of predefined scopes, and the Edit Scopes button that lets you easily create your own.

Each scope is assigned a distinct color/font scheme — just like different language elements in Java, which makes it easy to distinguish from other code in the editor.

In the following example, it is used to quickly differentiate between real testing code and JUnit Classes (pattern: lib:org.junit..*):



Other use cases include highlighting of, for example, third-party framework code, distinguishing normal code from assertions, etc.

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“).