Create a Class Really Quickly
Tuesday, March 31st, 2009To quickly create a new class I press Alt+Home and then Alt+Ins. And you?

To quickly create a new class I press Alt+Home and then Alt+Ins. And you?

IntelliJ IDEA auto-import popup is a very handy feature that lets you stop worrying about import statements in your Java class files. However, sometimes it can show more choices than you need (e.g. when some of the class names in your project match the names of internal JDK or unrelated library classes).
To make auto-import easier to use and to avoid accidental imports of wrong classes, you can open the Settings dialog, then go to Editor | Auto-Import and add their package prefixes to the exclusion list. This will also hide the specified classes from class name completion lists.
It is a well known rule that assert statements should cause no changes in state outside of them (aka side effects). Until now, you could only check if this rule was followed by visually inspecting the code. In IntelliJ IDEA 9 a new assert statement with side effects inspection will be available to help you keep assert statements free of side effects.
The inspection will warn about modification of variables and fields inside of the assert statement. The assert statement will also be reported if a method called by it modifies any fields.
To change settings of a module that hosts the file you are currently editing, just press Alt+F1, 7 or open the View menu, select Select In and click Project Structure.
IntelliJ IDEA will open the Project Structure dialog and jump to the required module.
This action works for files from libraries and JDK, too, and is available in every view that lists files — Project View, Changes tool window and so on.
As you may know, IntelliJ IDEA 8 includes the complete i18nization support. In IntelliJ IDEA 9 (Maia) it will be improved with special i18n foldings that would allow to hide method calls, retrieving properties from resource bundles and replace them with actual property values.

If properties contain any parameters, they will be automatically evaluated before displaying.
I often forget to add newly created tests to the testng.xml, which is used in our TeamCity build, and by the time I realize that they don’t run something is surely went wrong. What a bummer! Not any more, fortunately — IntelliJ IDEA makes sure no tests are missing. All it takes is to enable the Undeclared test inspection under TestNG in the Errors section of the Settings dialog.
Many API include methods like setXxx(int) where int is one of the predefined values, typically declared in the same class. The fact that these are just legacy methods that have been created prior to enums invention, does not stop IntelliJ IDEA from helping you with such parameter values. For example, have a look at JList#getSelectionModel. Just invoke the Smart Completion (Ctrl+Shift+Space) inside the call parentheses:
In IntelliJ IDEA you can quickly configure language injection for XML tags, attributes and Java method parameters and their return values. Just use Inject Language Intention on the code like this:
and it will immediately turn to:

And you get the complete coding assistance, with syntax and error highlighting, completion and navigation.
This functionality is provided by the bundled IntelliLang plugin. The full configuration is available for edit in the Settings dialog (see screenshot below). Default configuration includes various mappings like RegExp language in Pattern.compile(), SQL in JDBC API calls, JPA & Hibernate QL injections and much more.
IntelliJ IDEA 8 support for Spring Webflow includes:

With IntelliJ IDEA you can quickly clean up your legacy code. If a problem occurs multiple times in a file, you do not need to manually apply a quick-fix every time — use the Fix all intention to repair them all at once.