From IntelliJ IDEA to Eclipse (4)

Today I’ll try to focus on key shortcuts more. And also the way you can customize them. In all cases when comparing shortcuts, the first one mentioned is Idea’s, the second is from Eclipse.

While Idea has static Default Keymap Reference in its Help menu, Eclipse has Key Assist (Ctrl+Shift+L) – which is more handy if you don’t know what you’re looking for (name of the features are not always the same between both products). Idea’s Search Action (Ctrl+Shift+A) can compensate for this. Talking about Help menu – you can check some JetBrains TV videos about IDEA to get better idea how to be productive or just for some tips.

There is Idea keymap for Eclipse (plugin), but I wasn’t satisfied with it’s completeness, plus I wasn’t happy with Idea shortcut acting the Eclipse way – and you can’t change that. :-) And I also want to be able use Eclipse on colleague’s computers too – so why not to learn it with its shortcuts? Well…

One recommendation actually – duplicate (called copy line in Eclipse) and delete line – you may want to change those. You can mostly live with rest (yes even with Enter vs Tab to confirm completion) but Ctrl+D will soon kill you, especially if you are forced to work in Eclipse more than you can in Idea. I changed it in the Default scheme, because when I wanted to create a new one, I found out it’s not possible in any simple way.

Shortcut Schemes cannot be copied inside of Eclipse. If you’re wondering how to create a new one, wonder no more – you have to do it this way (not that I understand that page too much). I’m also not sure how you can add more binds to one action (not a sequence, but two different combinations). Long way to catch Idea on this one.

OK, and now some “Idea-Eclipse remapping” right?

  • Alt+Enter is Ctrl+1 – called quick fix
  • Ctrl+H is F4 – view type hierarchy
  • Ctrl+B or F4 is F3 (Ctrl+left click works the same, though a bit lazily – you have to wait till Eclipse underlines the stuff – maybe even move the cursor a bit, sometimes I can’t force Eclipse to understand this) – you’ll probably mess F3 with F4 a bit
  • F3, Shift+F3 is Ctrl+K and Ctrl+Shift+K – next/previous search, in Eclipse you can just select stuff and press Ctrl+K, in Idea you have to Ctrl+F it or highlight it with Ctrl+Shift+F7, then F3
  • F2, Shift+F2 is Ctrl+. and Ctrl+, – next/previous error/warning, in both IDEs you can set to focus on errors first instead of mixing warnings in too – in Eclipse go to Preferences, General, Editors, Text Editors, Annotations and there you can include many things into this kind of search
  • Ctrl+Y is Ctrl+D – what a shock for delete a line :-)
  • Ctrl+D is Ctrl+Alt+Down/Up (but only for whole lines) – now you see why I recommend to switch at least this, Eclipse’s option to copy up or down is quite nice, though minor feature
  • Ctrl+W/Ctrl+Shift+W is Alt+Shift+Up/Down – but the selection jumps differently than in Idea and you will probably not like it at all, in Idea it really starts with word – even inside of strings, but not in Eclipse; funny enough, while word selection is way too eager in Eclipse, Ctrl+Left/Right jumps to camel humps inside words (which in most cases is too slow for me, but YMMV of course, you can switch it in Preferences); you will also probably hate selection expansion on property names, where I want to start with one word again, not the whole property
  • Eclipse has Ctrl+J for incremental search – this is mostly similar to Ctrl+F in Idea, though Idea’s Enter/Escape workflow in the search bar could be better for smoother feel (but maybe nobody feels the same)
  • Ctrl+G is Ctrl+L – go to line
  • Ctrl+Alt+V (as variable) is Alt+Shift+L (as local)
  • Ctrl+Alt+C (constant) is only in menu – Alt-T (T as refactor :-)) and there press A (as … well, constant). This leads us to menu mnemonics. Maybe in Eclipse they are problematic because of some history (that is shorter than Idea, BTW), I don’t know. But however you look at it, refactor is not so important, so intuitive, you have to remember strange shortcuts or add your own (which means changes to the Default key scheme for most normal users)
  • Instead of File Structure View (Ctrl+F12) you have Outline (Ctrl+O) in Eclipse. While in outline you can lookup any member from nested classes (something I suggested for Idea a few days back) you can’t use camel humps lookup (gF for getFilter for instance)
  • Ctrl+N is Ctrl+Shift+T to find class quickly – camel humps work nicely in both
  • Ctrl+Shift+N is Ctrl+Shift+R to find any resource (file)

Find in path (Idea’s Ctrl+Shift+F) is quite a pain really. There is no item for this in context menu on the project tree, you have to select the directory, go to menu Search and select File… I don’t feel like searching for file, I take it more like searching for occurrences, but whatever. After this you have to switch radio button to “Selected resources” (I honestly wouldn’t understand that without help, though directory is kinda resource too, right?) and there you go finally. Many Eclipse users don’t know what that radio button means and they rather go with working sets or just change pattern for files if possible. Very, very non-intuitive.

Find usages (Alt+F7) is here (Ctrl+H) but funny enough my Eclipse mates wondered why I ask if I can see the actual lines with occurrence in the search results. Maybe just to know how the same method was used without going to the source! :-) I’m sure we (Idea users) miss some funny features from Eclipse too and we don’t know about them yet. Sometimes I’m in doubt if we all code in Java really – so many mindset differences. Also be aware that Eclipse might open all your search results in a single tab – you can change this in Preferences. Also the behavior of this find is very annoying. In non-java files it mostly offers File Search (text search) tab as default, but in Java it offers Java Search with File Search tab missing altogether. That’s the famous “context-awareness” of Eclipse in its worst moments, if you ask me.

Comment the line (Ctrl+/ in both IDEs) works in Java but not in XML/HTML/CSS [EDIT: reportedly it does for JavaEE version]. (CSS doesn’t work in Idea Community Edition either, but then – CSS syntax is officially not supported there.)

Alt+Shift+Insert for column selection mode is Alt+Shift+A. No problem with selection behavior either.

Open recently closed editors with Ctrl+E? Depends… there is no list of files recently closed (quite a shame if you ask me), but you can quickly reopen the last one using Ctrl+Q (last edit location) or hope that your recently closed tab was one of those recently open and then you can use Alt+F and some number (default last 4 can be changed to 9, I strongly recommend that if you need it in your workflow). This is feature I really miss in Eclipse – and from what I asked, many Eclipse users too.

Finally two more links:

I have a bunch of other things prepared, completion comparison mostly with some animated gifs, so stay tuned!

Don’t miss other posts on this topic:
Eclipse vs IntelliJ IDEA
From IntelliJ IDEA to Eclipse (2)
Why to synchronize with SVN in Eclipse?
From IntelliJ IDEA to Eclipse (3)
From IntelliJ IDEA to Eclipse (5)

About these ads

About virgo47
Java Developer by profession in the first place. Gamer and amateur musician. And father too. Naive believer in brighter future. Step by step.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 221 other followers