From IntelliJ IDEA to Eclipse (2)
February 22, 2011 4 Comments
This is hardly a guide, but it may still be useful – or just please random Idea users – whatever. 🙂 This is sort of continuation of my previous rant and I expect more to come when I find out how to do some stuff in Eclipse. All my pros about Eclipse still applies (EMF, plugins, all these corporation doing their own plugins for easier development – there are reasons for this), let’s now see what I really miss or what is different.
If you want to try IntelliJ IDEA (just out of curiosity, if you’re Eclipse users) you can read migration article here. IBM offers their thorough guide for migration to Eclipse here. The biggest terminology mismatch is about workspace, projects and modules – it’s explained in both guides. I didn’t open our Java Simon project in Eclipse yet – maybe then I’d understand it better. Right now I have one workspace with more projects in the “project” sense of the word. In Idea I open one project in one window – as always. So for me project is project. But then I didn’t try to force Eclipse to compile part of the project with one JDK and other with different – maybe then I’d need to break modules to Eclipse projects. However, while it is terminology mess obviously, it’s not the most important thing.
After spending some time with Eclipse you might wanna change editor colours and syntax highlighting. Shame is that there is no obvious way how to save the colour scheme but you should be OK with changing just a few things so it’s less blue/grey only. Quick Diff colours are the first candidates, then maybe comments and Java syntax. Then you may feel more like home and also I just simply see better. Exploration of the Preferences is one of those recommended things to learn about what you can tweak. IF you find it in the first place though – I google a lot regarding how to set this and that in Eclipse. This surely applies for the migration to Idea too.
Formatter in Eclipse may be better configurable (I don’t know, but it seems so from the flood of options) but the overall results are often worse (because of all those options). Ultimately you’ll get what you want though – but settings for XML doesn’t seem to be part of the formatter after all (correct me if I’m wrong). In Idea you have Code Style, you can use global settings or settings for a project and all file types are under Code Style (no formatter bits scattered in the settings tree). While there seems to be no export from GUI in Idea (like in Eclipse) it’s easy to locate code style profile XML files on disk (Idea’s config/codestyles directory somewhere in your homedir) and share them.
There are many concept differences between both IDEs but I don’t care about them that much – as I can hardly do something about them. I can compare editors though. There are some conceptual differences between editors itself too, but in the end it’s about what this one completes and that one doesn’t, etc. As I work more and more with Eclipse, I’m surprised it doesn’t have some (basic?) things. Of course you can always tell him “do this and this”, but Idea often just knows. Now this is not the same as “my Ctrl+Space does it all while you have tons of shortcuts for it”. Yes, sometimes you have to tell Idea “do this” with proper shortcut. But I don’t have to suggest enum type name to complete for instance!
Eclipse doesn’t skip over closing braces/parenthesis if you move the cursor there, but skips nicely right after they are autoinserted. This might be better than Idea’s way actually. I like that Idea gets me out of parentheses, but in many cases I could figure this myself – and often I have real problem to insert new end parenthesis before you open it (so what! I do it from back to start sometimes! :-)). Little note to parentheses highlighting – Idea shows the pair when you’re out, Eclipse when you’re in. Whatever. Idea is better visible – as nearly always.
Recently I discovered Idea’s “Complete Statement” feature (Ctrl+Shift+Enter) – see video here. Not only I found it’s something I missed for years (but just don’t check every missing feature, right?) but it’s also the best way how to emulate “o” command from vi editor (add next line and go to insert mode). These features are missing in Eclipse – at least out of the box.
I mentioned automatic symbol highlighting (or none at all) in my first post – if Eclipse has highlighing on demand it’s not easy to find because none of my colleagues doesn’t know about it. I checked some introduction video for IDEA Community Edition (must see – because every time I learn something new – or forgotten) and I was shocked by automatic highlighting there. I had to open Idea and check how they screwed it, broke it or whatever. Feature is described here. But Idea didn’t let me down. Even with automatic highlighting on you can still stick it with Ctrl+Shift+F7. So you can have best of both worlds – of course on Idea. (At least when we’re talking about highlighting.)
I’ll focus more on keyboard shortcuts in the next episode – how they relate in Idea and Eclipse, what you can and can not expect, etc. Today it’s time to slowly wrap up the article – but we can’t not to mention perspectives, right? 😉
First go about debugging (more to come later!). When you have a warning on a line (light bulb in the gutter), try toggle the breakpoint on that line. Can you see it? I can’t. Luckily I have good colleagues. “You have to go to Debug perspective…” “Ah, different perspective! Of course…” “…and then switch that tab there to Breakpoints and… see? Now you don’t have it on that line. And now you have it there. Easy.” (But yeah, even they were chuckling a bit.)
Eclipse isn’t bad at all of course, I still recall my colleague’s (kinda ironic): “What do you want? It’s for free!” But then, even “smaller” Idea is – and while it lacks a lot of Java EE support, it’s still “Develop with pleasure”. As a final note – when you find yourself stuck with maximized code window (Ctrl+M in Eclipse – and I use it a lot) fighting the Project Explorer that is not docked properly and you don’t know why… just switch from Team Synchronizing to Java perspective. Maybe you’ll get used to it sooner than me.
You can actually say: If something is wrong, it’s probably your (Eclipse) perspective. 🙂
Don’t miss other posts on this topic:
Eclipse vs IntelliJ IDEA
Why to synchronize with SVN in Eclipse?
From IntelliJ IDEA to Eclipse (3)
From IntelliJ IDEA to Eclipse (4)
From IntelliJ IDEA to Eclipse (5)