The whole point of an IDE is to help you develop faster and with fewer errors. Eclipse PDT has many features that can help accomplish this, but if you don’t know what those features are and don’t use them, then you might as well just use notepad. Here are a few shortcuts that I’ve found very helpful:
- Holding CTRL and hovering over a user defined function will give you an insight window showing you the code that comprises the function.

This is especially helpful when you are working on a project that you did not write and you just want to know what the code for the user function is without having to open another window and look through all the functions in the included file. - Another great feature is templates. This is especially helpful in writing XHTML as it can be repetitive. Templates can be a great way of saving a lot of keystrokes!
- Click Window->Preferences

- Then click New

- For the purposes of this article I’ve created a simple select template with a label

I personally start my templates with the “`” symbol so that i can quickly get to all of my templates in the Eclipse code completion bypassing all the other built in suggestions. A powerful feature of templates is that you can insert user variables, or pre-defined variables that allow you to tab to their positions when you insert a template. In this case, I have a predefined variable ${cursor} which is the last position of the cursor when all other variable values have been defined. I have two user defined variables called ${id}. The great thing about this is that when you have two or more variables with the same name, as your typing in the value for the first variable, it automatically fills in the value for the second (or third etc…). This can save alot of time and finger effort. To use your template simply press ‘ctrl+space’ and it will start your code completion and press the “`” symbol and start typing ’select’. When you see the template you want highlighted press enter and it inserts the template and you can tab through the different variables. Notice as your typing in the value for the first ${id} the other variables automatically being filled in. When your done, your cursor ends up in between the opening and closing tags and you can create option tags in the same way.

- Click Window->Preferences
- Another nifty tool Eclipse provides is a shortcut to your resources by pressing ctrl+shift+r. I’ve found this extremely helpful when trying to find and open files

- If your not using CVS to keep track of your changes Eclipse keeps track of changes locally in its local history. If you’ve made changes that you didn’t mean to make you can revert back to an earlier version of the file by right clicking in the editor and going to Compare With->Local History and it will bring up a list of file revisions. To see the revisions simply double click on the one you wish to see and it will give you a graphical representation of the changes made to the file

while CVS or Subversion is far superior, this little feature can save you hours of work if you’ve made changes that you wish to go back on. - Another time saving feature is the ability to search and replace selected lines. This example is for illustration purposes, but there are many times when you can use this feature in the real world. Simply select the lines of code you wish to do a search/replace and press ctrl+f and in the dialog box, ensure that the ‘Selected Lines’ radio button is checked

There are many more features that Eclipse PDT has that aren’t mentioned in this article, but there are a few good ones that can help save alot of time and help you to be more productive.
2 Responses to “Making Eclipse PDT work for you”
Leave a Reply
You must be logged in to post a comment.

May 27th, 2008 at 6:16 am
Thanks for pointing those things out, I started using PDT today and everything that will speed up my coding time is highly appericated!
February 4th, 2009 at 1:38 pm
cool, thanks for that.