From Eclipse to IntelliJ IDEA 11

von

I have once tried IntelliJ IDEA and was slammed down by this IDE. I took only a few hours to explore it and then did go back to Eclipse. Then, a few months later, Yann Cebron came up with an announcement: the new Strut 2 plugin for IntelliJ IDEA 11. This and thousand people on Twitter made me look at IntelliJ IDEA again. This time I told myself not to give up before 7 days passed. While the first days I had Eclipse open when I worked with IntelliJ. In the middle of the week I was near to give up. But on the sixth day I had some joy, and meanwhile I cannot imagine to go back. Actually it takes some time to get into this IDE but it is worth it.

What is wrong with Eclipse?

I downloaded Eclipse, opened the package, started, imported my project and use code completing. And it failed with a NullPointer Exception. This happens from time to time. The code editor is so plain, it looks like my text editor. Maven integration: mvn eclipse:eclipse. There is much more I miss, but I didn’t know that until I came to IntelliJ IDEA later. After all, I have always felt since Eclipse became a “Platform”, it has lost the steam behind the IDE. OK, it looks good and all. But I want an IDE. Would I choose a platform with some IDE features to work? Or a product which is focusing on IDE features?

I must say, I am annoyed by the poor quality of some plugins and the lack of development the IDE (not the platform) seems to have. And I have used it since version 2.1 (2003?).

Anyway, Eclipse is Open Source. IntelliJ is not. This is sad. :-(

Things worth to know when migrating to IDEA

I have not found anything IntelliJ IDEA can’t do compared with Eclipse. It just took me a while to understand how it all works. Especially the Keyboard shortcuts are heavy to learn: much more than in Eclipse! It feels like IDEA is a graphical commandline. This is fantastic if you have learned it already, but heavy at the start.

One thing I don’t like in IntelliJ is source control. It works, but I have always a strange feeling with it. Anyway Eclipse bugged me there too and so the command line is my best friend when it comes to SVN.

Maven Integration

Do not import your projects from Eclipse. If you have a POM file, then create a new project from Maven instead. IDEA will take care on downloading your dependencies, if you add something to the POM then. It automatically puts it on your classpath. You don’t need (and should never use) mvn idea:idea. But please, do not import projects from Eclipse.

Creating new Tests

CMD-SHIFT-T will create a new Test for you. Or it will take you to the test, if you already wrote one. While creating can be done in Eclipse similar, jumping to the Test is not so easy.

Jump the way you like it, Baby!

The Struts plugin and the Spring plugin somehow configures by magic. You just need to say “yes” (and sign with your Blood). After that you are able to to jump from the class to the Spring bean configuration. Or from the Spring Bean config to the Bean. Same is true for the struts.xml. Jump to the Action and vice versa. It could not be easier. This feature alone is it worth to throw away Eclipse.

Code Generation

IntelliJ lets you generate code. The shortcut is CTRL-N. It is simply cooler than CMD-SHIFT-T in Eclipse. And as it is context relative it gives you the options you want exactly from this context.

While IntelliJ lets you create variables and members from a methods return type, Eclipse only allows the STRG-1 quickfix for local vars (to my knowledge).

An excessive number of live templates allow quick code generation for the rest. It is CMD-J. It is a very impressive list and not to compare with the templates from Eclipse. You can even surround a codeblock with them and some more magic.

Resource Bundle Editor

Not sure if this is part of IntelliJ or of the Struts plugin… but if you open Struts 2 resource bundles, like package_de.properties, you will see a second tab. Clicking on that you can choose one of your keys and all translations are shown on the right side of the editor, ready to be translated. If a translation is missing in the other property files, the key shown in red. Thanks, this was one of most useful plugins I have ever seen. After knowing this is possible, I looked if there is something similar for Eclipse. Didn’t not find anything which worked for me.

Code Completion

As I saw that I have code completion for Resource Bundle entries, I fell in love. But it is more. I have it when adding a Action class to my struts.xml. I have it in my HTML editors - but not only matching HTML tags, also CSS is recognized.

JavaScript

Navigate through JavaScript nearly as good as in Java. Since I use IntelliJ I get a better understanding of what I am doing. In JS code completion there are some buttons showing what is supported where - there are little Firefox Icons when you are about to call a Firefox method. This is pretty nice!

What do I miss with Eclipse

CMD-O shows me the outline of my class in Eclipse. Usually I have the Outline-Widget closed and just need a floating window from time to time. Something like that I do not have in IntelliJ. But I can work around it. There is a structure view I can open with a shortcut (of course). It is not so nice as the Eclipse one, but hey it works.

If you are used to the Eclipse look, IntelliJ looks very old and ugly to you. Well, meanwhile I can live with it. Just a matter of getting used. You can switch themes to whatever is possible with Swing.

I have not found a “autobuild” setting. In Eclipse my code is compiled whenever I hit save and I see immediately all my syntax errors in the output. No clue how IntelliJ does it, but I found it pretty difficult to see the small reddish lines which mark problems (I am not good with this red/green stuff). I would prefer some kind of console output which is easy to read. Well, I meanwhile get used to this, but I really would wish I could see it better. There are several minor things which are not visible enough, some stuff looks really overloaded.

After all, Eclipse looks better, has an Outline and that autobuild feature with a console. “Looks better” does not count for what is inside the editor. IntelliJ uses more colors and that is wonderful. Working with IntelliJ made me faster than before. It is like an Eclipse how it should be, just a bit ugly.

If you want to start with IntelliJ, I suggest you give yourself 5 days for trying.

Tags: #IDE #Java

Newsletter

ABMELDEN