In IntelliJ I can easily rearrange the order of statements (or whole methods for that part) by pressing ⌘ + Shift + ↑ (or ⌘ + Shift + ↓).
I was wondering whether there's a shortcut to change the order of method parameters as easily, so that
public void sth(String a, String b) {...}
will become
public void sth(String b, String a) {...}
with the stroke of a keyboard shortcut (assuming my cursor is positioned on one of the parameters).
It would be enough for me, if IntelliJ would just reorder the parameters. That is, this need not trigger a whole Refactor > Change method signature thing.
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.
In past IntelliJ versions, ctrl+shift+f would search the entire project (no matter whether you had at some point used "find in path").
You need to go to Settings (Ctrl + Alt +S) -> Editor -> Code Style -> Java -> Arrangement (tab) and scroll down until you find the icons with methods . There you can manipulate the options to sort them by visibility, or alphabetically, or to keep related ones grouped together.
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!"
Since IDEA 16 EAP, there's an action for that. It's in the menu:
Code | Move Element Left/Right
Keyboard shortcuts are Alt+Ctrl+Shift+Left/Right (Alt+Cmd+Shift+Left/Right for OSX).
See http://blog.jetbrains.com/idea/2016/01/intellij-idea-16-eap-improves-editor-and-vcs-integration/ for more details.
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