Advanced use of Eclipse for Java

Eclipse is a wonderful tool when you’re developing big projects using the Java programming language, but it’s easy to just see the monster as one big, buggy, slow, heck of a program and just enjoy a simple text editor with a few tweakings for syntax highlighting.

But as you come to use it on a regular basis a few tricks comes, almost naturally, to help you get more efficient. I’m just going to present a few that i use regularly, and that makes me keep using Eclipse :

  • Auto-completion tool (+ with javadoc) : Ctrl + space

I won’t go presenting this one, everyone knows, but you just have to test it to be able to savour it the way it should.

  • Open type (class, Interface etc…) search engine : Ctrl + shift + T (Cmd + shift + T under MacOsX)

openType

  • Quick refactor : Alt + shift + R

refactor

  • Delete a line : ctrl + D
  • Delete a line, word by word (with camelCase handling)

Allows you to delete Words step by step : e.g. parRotSubscription will become  parRot

  • Change method Signature  : Alt + shift + C

signature

  • Usage search of a method/attribute : Ctrl + Shift + G

You just have to select the attribute or method, and it will search for you where this object is used.

  • Show the type hierarchy : F4

Shows the full hierarchy of the class/interface, showing ancestors and descendents.

call

  • Organize Imports : Ctrl + Shift + O

This is, in my view, the most useful function : it allows you to remove un-used imports (e.g. import java.io.IOException;) and add the one you need « precisely » so that you don’t go adding import java.*

  • Comment selected lines : Ctrl + shift + C

The last one to comment full paragraphs and lines of code, and un-comment them when you need to.

I know that many of so-called geeks are able to make vim or emacs do it all, but the refactor functions of the jdt Core of Eclipse makes it so easy, it’s just a burden sometimes to have to use other IDE.

Publicités

2 Commentaires

  1. and F3 to show definition.

    1. F4 show hierarchy
      Ctrl + F11 Run
      Ctrl + Shift + G Show uses in workspace
      Ctrl + O show attributes and methods in Type
      Ctrl + I Indentation

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s

%d blogueurs aiment cette page :