File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse: try-catch code completion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse: try-catch code completion" Watch "Eclipse: try-catch code completion" New topic

Eclipse: try-catch code completion

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I am using Eclipse 3.0.1. When I write coding, for example, I type "try", it will not give all code completion, it will not generate [b]automatically[b] whole try-catch template, and If-else will not, either.

How to set it up ? I think it will be more convenient.
Pavan Kumar
Ranch Hand

Joined: Jan 23, 2004
Posts: 78
Hello Edward,

When you type try and press Ctrl + spacebar, a popup will appear with options, you could select try-catch block.

Second option, if you want a block of code to be surrounded with a try catch block, select the code that you want to be included in try-catch, right click brings up a popup menu source->surround with try-catch block.

For more options, go to Window-->preferences-->java-->editor-->templates.

This has a list of all quick assists.

Hope that helps,

formerly known as Cnu
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
But the problem is , when I type try, and press Ctrl+Space, nothing will pop up. And I change the java template, it will NOT work.

I don't know why.

Thanks .
I agree. Here's the link:
subject: Eclipse: try-catch code completion
It's not a secret anymore!