Is IntelliJ IDEA shining through Eclipse?

(P) Codever is an open source bookmarks and snippets manager for developers & co. See our How To guides to help you get started. Public bookmarks repos on Github ⭐🙏
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 Codepedia.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.
Contents
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 |
Ctrl+Alt+F7 (popup) Alt+F7 (Found console) |
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 |
Run tests |
||
Run as JUnit Test (valid both for test classes and methods) | Alt+Shift+X,T | Ctrl+Shift+F10 |
Debug as JUnit Test | Alt+Shift+D,T |
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
Find action by name
If you cannot remember a shortcut, you can find the actions by name as well as the settings, using the Ctrl+Shift+A – well, this one you need to remember though…
Lets’s say you’d want to find the shortcut for Find usages for example, then click Ctrl+Shift+A and then start typing “Find usage” in the search box:
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…
Note:
Actually you can have this feature in IntelliJ also, only that is disabled by default. Go to File > Settings > General > Editor and check “Show quick documentation on mouse move” (You can also set the delay). Thank you Крис for pointing this out.
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.