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

Thursday, December 07, 2006

What method am I in? Do Alt-Q to find out.

Tuesday, November 21, 2006

Camelback shortcuts: Let's say you have a class named DealCommitmentTypeBuilder. Sure, you can type the beginning and then do ctrl-space or ctrl-shift-space to get the name to pop up.

But did you know you can just type DCTB and ctrl-(shift)-space? Just type the capital letters.

Bonus tip: this works in the Ctrl-N and Ctrl-Shift-N windows as well.

Wednesday, November 15, 2006

What's the difference between Make and Rebuild? Answer: it's a known unknown, and the documentation is wrong: see this bug.
Change a Perfoce comment without submitting the changelist! Right-click on it and select Rename Changelist. (I've already filed a bug with IDEA to rename that command Modify Changelist.)

Tuesday, October 31, 2006

Tired of the 80-character margin?
  • File -> Settings -> Project Code Style -> General Tab
  • At bottom left there's a Right Margin (columns) box: just type in a bigger number.
Maintain multiple search results!

When you do Ctrl-F, or Alt-F7, or any search, look on the right for a small checkbox "Open in new tab." It will be grayed out on the first search, but not on subsequent searches.

If you check it, each new search will appear in its own tab instead of overwriting the previous search results!