Is IntelliJ IDEA shining through Eclipse?
As a long time Eclipse user, I want to give a more serious look to IntelliJ IDEA. The people from JetBrains were very nice and granted me an open source license for the Podcastpedia.org and Codingpedia.org projects. In the post I listed some of the things I use often in Eclipse and their equivalent in IntelliJ. I wrote this post so I can bookmark it and come back to, whenever I forget something, and if it helps others the better.
Keyboard shortcuts
So firt things first. Here’s a list of the shortcuts I use or ought to be using the most:
Description | Eclipse | IntelliJ |
Code completion | Ctrl+Space | Ctrl+Space |
Open class or interface (in both cases you can ease the search by filtering the lookup list with the help of the “camel words” prefixes e.g. “PoDI” will also list the PodcastDaoImpl class) | Ctrl+Shif +T | Ctrl+N |
Open file/resource quickly | Ctrl+Shift+R | Ctrl+Shift +N |
Refactor/Rename classes | Alt+Shift+R | Shift+F6 |
Open declaration | F3 | Ctrl+B |
View Javadoc / Details | Mouse Over (F2 focus) | Ctrl+Q |
Quick fix | Ctrl+1 | Alt+Enter |
Organize imports | Ctrl+Shift+O | Ctrl+Alt+O |
Save file / Save all files | Ctrl+S / Ctrl+Shift+S | Don’t need to. Happens automatically |
File Structure pop-up for quick navigation through the current file (members, methods) | Ctrl+O | Ctrl+F12 |
Source (Generate getters/setters, constructor etc.) | Alt+Up /Alt+Down | Alt+Insert |
Maximize Editor | Ctrl+M (works for any current view with focus on) | Ctrl+Shift+F12 |
Source (Generate getters/setters, constructor etc.) | Alt+Up /Alt+Down | Alt+Insert |
Complete current statement such as if, do-while, try-catch, return (or a method call) into a syntactically correct construct (e.g. add curly braces) | Ctrl+Shift+Enter | |
Extract constant | Ctrl+1 -> Extract to constant | Ctrl+Alt+C |
Extract variable | Ctrl+1 -> Extract to variable | Ctrl+Alt+V |
Adding, Deleting and Moving Lines | ||
Add new line after the one at caret | Shift+Enter | Shift+Enter |
Duplicate line or code fragment | Ctrl+Alt+Up/Down | Ctrl+D |
Remove line | Ctrl+D | Ctrl+Y |
Move row or entire selection up or down | Alt+Up/Down | Shift+Alt+Up/Down |
Find/Search | ||
Find usage of class/variable in workspace / project | Ctrl+Shift+G | Alt+F7 |
Find text in project/workspace project | Ctrl+H (choose File Search) | Ctrl+Shift+F |
Navigation | ||
Back (Undo last navigation operation) | Alt+Left | Ctrl+Alt+Left |
Back (Undo last navigation operation) | Alt+ Left | Ctrl + Alt + Left |
Navigate between tabs/editors | Ctrl + Page Down / Up | Alt + Left/Alt + Right |
Go to line | Ctrl + L | Ctrl + G |
Navigate to recent files | Ctrl + E | Ctrl + E |
Quickly move between methods in the editor | Alt + Up / Down | |
Debug | ||
Step over | F6 | F8 |
Step into | F5 | F7 |
Step out | F7 | Shift + F8 |
Resume | F8 | F9 |
Link to editor
I often find myself when editing a file and to need to edit others files in the same context. For example ff it is a class usually, I also work on others classes in the same package – you can quickly navigate to the other class in the package by having the Link to Editor feature turned on. What does it do? Whenever I edit a file it diplays it instantly in the package explorer/project. If you take vertical packaging approach, which holds classes together based on functionality rather than on layers (dao, service etc.), which I highly recommend, this comes pretty handy.
Eclipse
Go to the Project Explorer or Package Explorer View and click on the Link to Editor button
If you don’t want to enable this feature, you can still navigate to the package/project explorer hierarchy by using the keys combination Alt + Shift + W and select where you want to show it:
IntelliJ
In the Project or Packages view select Settings and then Autoscroll From Source
If you don’t want to enable this feature you can still navigate by using the keys combination Alt + F1 and select where you want to show it:
What I really like about IntelliJ
Lots of things by default
IntelliJ comes with a lots of features provided by default (e.g. GitHub integration – have to check that one :)). Of course in Eclipse you can also get lots of functionality, by selecting on of the more specialized versions, but most likely you’ll still have to configure this or that plugin…
Change Font size using the mouse wheel
You can change font size using the mouse wheel (feature I heavily use in browser). But you need first to enable it:
- Open the IDE Settings (Ctrl+Shift+S or over the Menu File > Settings)
- On the Editor page (type Editor in the search bar), make sure that the setting Change font size (Zoom) with Ctrl+MouseWheel is enabled.
Launch terminal directly in the IDE
Alt + F12
Cool live templates
Type p and press Ctrl + J, then you get following options:
- psf – public static final
- psfi – public static final int
- psfs – public static final String
- psvm – main method declaration
Great JavaScript/HTML5 support
The commercial version (IntelliJ Ultimate), should include ultimate code assistance for HTML5, CSS3, SASS, LESS, JavaScript, CoffeeScript, Node.js, ActionScript and other languages. Promise to check this pretty soon.
What I miss from Eclipse
Cannot maximize console
Ctrl + M on the console. I haven’t found an easy way to maximize the console output, like a double click on the tab or Ctrl+M from Eclipse.
Show javadoc when hovering with the mouse
Of course you have the Ctrl + Q to get the same effect, but it’s so nice in Eclipse when you just hover of class and receive a snippet of its javadoc…
Summary
The feeling – I find both IDEs great, IntelliJ looks more modern, but on the same time I like the “classicness” of Eclipse, but that’s maybe because I so much more used to it. Will relate about this later…
Well, that’s all I have so far, but I’ll try to add features to the comparison should I come accross them and the time will allow it, so stay tuned.
Resources
- IntelliJ IDEA Q&A for Eclipse Users
- IntelliJ IDEA – Keyboard Shortcuts You Cannot Miss
- Eclipse Shortcuts – Tutorial
Reference: | Is IntelliJ IDEA shining through Eclipse? from our JCG partner Adrian Matei at the Codingpedia.org blog. |
What is even cooler about live templates – you can type psfs + and get it immediately without any extra key presses. Same applies to postfix completion and others.
I used the community version of Idea for a few months at work, and I found that it is very nice to use, feels snappier than Eclipse (i7 8gb ram and ssd, both were fine but idea felt a bit lighter). I liked the whole “single window vs perspectives” approach, felt very natural. The two areas where I found Eclipse superior was the change management (liked Eclipse team sync better) and maven dependency examination (and maven in general). Plus the maximize console thing, if I need a big console I end up floating it and expanding the window to cover… Read more »
You can also set the key mappings to use eclipse settings for a quick transfer to intellij
> Show javadoc when hovering with the mouse
That feature is actually available in IntelliJ. Just open up the settings and go to Editor>General. There is an option called “Show quick doc on mouse move”. Enable it and set a delay that works for you.
Best regards,
Ben
Thanks for pointing out Ben. I updated the original post.
Cheers,
Adrian
This article comes in the right time, I’m considering switch from Eclipse to IntelliJ IDEA. :D
If you’ve ever configured Tomcat to run inside Eclipse and very easily stopped and started, I am curious what would be your experience with IntelliJ. I am pretty sure anyone pointed to the Servers pane in Eclipse can figure out the rest on how to install/integrate Tomcat into Eclipse and deploy your web apps to it, along with jars in the WEB-INF/lib directory. Try that with IntelliJ. I don’t find it straightforward at all. Maybe it’s because I am used to the way Eclipse does it, but after spending hours and hours googling and trying to figure it out, I… Read more »