I am using eclipse for quite a while, but for last year or so I am trying to get used to Intellij Idea because that is what they use at my current workplace.
One feature I can not find a substitute in Idea is ability of eclipse to add throws declarations. In Eclipse I could right click on a underlined string and select "Add throws declaration" which then adds it to my method signature, but I can't find it for life of me in Idea. Is there such a functionality in Idea?
Ctrl + H = "Type Hierarchy" view = shows a tree of parent and child classes of this class. Ctrl + Shift + A = "It does a search as you type through all the commands in intellij. Not only that but when you find the command you want it also displays the corresponding shortcut key next to it!"
In Eclipse, you press CTRL + SHIFT + O “Organize Imports” to import packages automatically. For IntelliJ IDEA, if you press CTRL + ALT + O “Optimize Imports”, it just removes some unused imports, never imports any package.
Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.
When a piece of code needs error handling, IntelliJ underlines it with red. Set your pointer on that piece of code and press ALT+ENTER. IntelliJ should now give you the choice to either surround it with try/catch, add a catch clause, or to add a throws declaration.
In your case: click the underlined code → ALT+ENTER → Add Exception to Method Signature
IntelliJ also has a shortcut to place your cursor on the next error or warning: F2. This – especially in combination with ALT+ENTER – is quite useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With