Tuesday, July 10, 2007

Refactor javadoc params: Consider the following javadoc:


/**
* If foo is prime, that's good.
* @param foo Bla bla bla.
*/
public void do(int foo) { ... }


If you refactor/rename the parameter "foo" (with Shift-F6), the second word in the javadoc won't get changed. To fix that, just write it as {@code foo} instead!


/**
* If {@code foo} is prime, that's good.
* @param foo Bla bla bla.
*/
public void do(int foo) { ... }

Monday, March 12, 2007

Make Ctrl-F12 work in non-Java files with F4. Ctrl-F12 sort of works in e.g. Javascript and Xml files, but every time you hit Enter, it just keeps on drilling down instead of going to the method or tag you want. The solution: at the first level, instead of pressing Enter, press F4.

Another solution: complain to IDEA about this.

Friday, February 16, 2007

Move a method with one keystroke! Put your cursor on the same line as a method declaration, at the very beginning of the line. Then Ctrl-Shift-Up Arrow will move the entire method above the previous one, including javadocs. Ctrl-Shift-Down Arrow to move it after the method below it. (Normally, Ctrl-Shift-Up/Down moves only the line your cursor is on.)