NetBeans Keyboard Shortcut of the Week (1)
By Geertjan-Oracle on Aug 10, 2006
"Another tip... it's worth it to check out the available editor shortcuts (Tools->Options->Keymap) now and then as a quick review of the features provided by the IDE! Then, select a new one to use, starting from now. Later, have a look again, and start using one more. It could significantly improve your coding."
I think this is a great tip (and he has several others, all equally practical, so be sure to read that interview when it is published on http://www.netbeans.org). So, I thought it might be cool to do exactly what Vladimir suggests, right here in this blog. Every week, I will pull a keyboard shortcut out of its relative obscurity and mention it here! Eventually, a lot of keyboard shortcuts should be covered that way. In addition, I will add the keyboard shortcut to the left sidebar in the new "Keyboard Shortcut of the Week" heading. So, to kick things off... I present to you the "Debug Identifier" shortcut. This is where you find it in the Keymap (which is part of the Options window):
In the NetBeans profile, this keyboard shortcut is mapped by default to "Ctrl + J D". This means that you first press "Ctrl + J". Once you have pressed that combination, you will see "Ctrl+J" in the IDE's status bar. Then, you press "D". This shortcut is not mapped to anything in the Eclipse and Emacs profiles, so there you'd have to do it yourself. And what does the shortcut do? Well, until 15 minutes ago, I didn't know that that shortcut even existed, but it is really pretty useful... and here's the story in 3 short pictures:
- Put the cursor in an identifier, like here in line 56, the cursor is inside msg:
- Press Ctrtl+J and then press D. I now magically, without any typing, have a brand new System.err.println in line 57, for the selected identifier:
Not bad, right?
- Now, when I deploy my application, the IDE shows me the server log in the Output window and I can see the error output that the generated line 57 requested:
Pretty useful. So, whenever you want that line for free, just put the cursor in the identifier and press Ctrl+J and then press D.
So, this keyboard shortcut is the 1st keyboard shortcut of the week and has pride of place in the left sidebar of this blog, for one whole week! And in honor of that, you should use it at least once a day for the rest of the week... Next week, same day, i.e., Thursday the 17th, the 2nd keyboard shortcut of the week will be announced... feel free to propose one (per week) if you like!