Alexandra has posted 1 posts at DZone. View Full User Profile

Some of the Things You'll Love About Eclipse JDT

  • submit to reddit

It's true, Eclipse does look very complex with all its plug-ins but taking time to get to know it is worth the effort. I've been saving a lot of time since I began using Eclipse and here are a few of the things I appreciate more:

  • Code Assist: Just press ctrl + space anywhere in the editor or start typing and then press ctrl + space. This is great for generics and not only.
code assist
  • Refactoring, just a right-click away. You can change the return type, the name and the access modifier of the method, you can add, edit and remove method parameters and exceptions and the best part is that the rest of your code that uses this method will be adapted to the modifications.

    Refactor/Rename works directly by selecting any member and then pressing Alt+Shift+R

    Refactor/Move easily moves methods, references, classes with little risk of damaging the rest of your code.

refactoringchange method signature

  • Quick Fix. You'll get a quick fix for almost anything. You'll also never have to type an import again.
quick fix_01quick fix_02
  • Another cool thing is that you can drag and drop the Java variables and methods in the Outline view and that will also affect the actual code.
drag and drop

  • Call Hierarchy opens a view with all the places where the method or variableis called. Clicking on any of the results in this view will take you to the location of the result. I found this to be really useful.
open call hierarchy

  • Externalize Strings. This is just wonderful and really time saving. You can choose to externalize the strings in the whole project or just in one class. Eclipse will create a new properties file containing the strings and a Messages class with references to it. You can choose not to externalize all the strings in the window that opens after choosing Source/Externalize Strings
externalize stringsexternalize Strings 2

These are just a few of the features that I use more often and I hope you'll find them useful.

Your rating: None Average: 5 (2 votes)
Published at DZone with permission of its author, Alexandra Niculai.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Tracy Nelson replied on Fri, 2009/07/17 - 1:38pm

One thing I'd add -- if you're on a line with a QuickFix available, pressing CTRL-1 (control-one) pops up the QuickFix dialog.  I find this handy when I've fat-fingered something; it's often quicker to hit ^1 and pick the first (often only) option than to mouse around and first click on that little light bulb and then on the option.  Maybe (probably!) it's just me, but it does make Eclipse just that much handier.

Alexandra Niculai replied on Fri, 2009/07/17 - 5:29pm in response to: Tracy Nelson

I totally agree.

Miguel C. replied on Fri, 2009/07/17 - 10:36pm

Another good trick is Alt+Shift+T that calls the refactoring view . Thank you for your article.

Alexandra Niculai replied on Sat, 2009/07/18 - 2:56am in response to: Miguel C.


Yes, that is cool. ctrl + shift + F is also cool. It will do source formatting. Of course you can set the formatting to be done each time you save the file(Window/Preferences/Java/Editor/Save actions/Format source code).

Vaclav Stumbauer replied on Sat, 2009/07/18 - 3:41am

some more bits

Ctrl + Shift + G when standing on a type, method, variable - shows all the references to the type, method, variable, similar to call hierarchy, but without hierarchy :-)

Ctrl + Shift +T  - open type - You can write just starting letters of every word if you want - e.g. AgreementManagerEJB (you write AMEJB and have it)

Ctrl + shift + R open resource   you're lookinge.g. for 2009_07_15_vs.sql and you have it in a second :-)

F3 - go to variable, method, type declaration (must be standing on it)

 Ctrl +1 - quickfix works even from the problems view list


Alexandra Niculai replied on Sat, 2009/07/18 - 4:15am in response to: Vaclav Stumbauer

Thanks! I wasn't aware of Ctrl + Shift +T (open type). That is going to help me A LOT.

Franklin Nwankwo replied on Sat, 2009/07/18 - 8:48am in response to: Alexandra Niculai

For a list of all the ever useful Eclipse shortcuts, type Ctrl+Shift+L.

Andrew Perepelytsya replied on Sun, 2009/07/19 - 10:16pm

Mmm, no. What is this article about? The very basic features that any mainstream IDE has. So, glad you love Eclipse, but otherwise just an information noise.

Alexandra Niculai replied on Mon, 2009/07/20 - 4:13am in response to: Andrew Perepelytsya


Yes, you do have the right to say what you think.

Bogdan Mocanu replied on Mon, 2009/07/20 - 2:10pm

Nice article, although it does contain basic information and shortcuts, most of them being the baseline of each programming day in Eclipse.

What I would like to point out is that Eclipse has a nice preferences page for setting shortcut keys for almost any action in the IDE. Here are some of the shortcuts that I have set:

Ctrl+Alt+S - Synchronize the selected resource (takes me directly to SVN Synch perspective and does a synchronization of the resource)

Ctrl+Alt+R - Run test (you could run the JUnit test with Alt+Shift+X, R, but it takes multiple keys to press, and it also doesn't work all the time... not sure why)

Ctrl+Alt+X - Run the selected resource as a Java application (just like for the shortcut above, it is easier to invoke the shortcut this way)

Tip: if you find yourself clicking the same actions or going through 3-4 menus just to perform an action, and you do this multiple times a day, do yourself a favor and set a shortcut key. It will save you multiple minutes and brain cycles :).

Alexandra Niculai replied on Tue, 2009/07/21 - 2:59am in response to: Bogdan Mocanu

 Thank you, Bogdan. And you're right, this is about how to make our lives easier each day. Not everyone has programmed in Eclipse before. I used to be a Netbeans user, actually, until recently. So I find this stuff in Eclipse really good.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.