"Wrap with try...catch" in IntelliJ?

Select the code, and then either:

  • Choose Code > Surround With
  • Press Ctrl-Alt-T. (Command-Option-T for OS X.)

I like to check the Productivity Guide under the Help menu from time to time. Not only does it tell me all the shortcuts, but it keeps track of how many times I've used each one and when I last used it. I can see how well I'm leveraging the shortcuts.


Ctrl Alt T brings a new terminal window in Linux systems. So right approach is Menu->Code and select Surround with...


Ubuntu:

"alt+c" -> "s" -> "6"

Mac:

"cmd+alt+t" -> "6"

Win (also Linux distrs if no conflict with system key binding):

"ctrl+alt+t" -> "6"