Intellij has a shortcut for moving the current method internally in the class ( I think it is Ctrl+Shift+{Up or Down Arrow})
I would like to know if Eclipse has the same functionality.
I could mark the whole method and then alt-arrow to move it, but then it would move one line at a time. I would like it to move one member for every keystroke.
I would also not like to use the mouse (in the outline view where one may re-order members of a class)
Of course, there is an IntelliJ Plugin available which makes IntelliJ IDEA behave like Eclipse (same shortcuts and compiler behaviour) but why do that? In the table below, in some cases, the shortcuts do not map 1:1 but they achieve the same effect. ctrl + alt + h (same!)
Shortcut to use Eclipse shortcuts in IntelliJ Idea: Press ctrl+`(also have tilde~ on it, button at the left side of digit 1). Then press 3 (Keymap) and select 2 (Eclipse). Done!
Display and Edit the Current Keyboard Shortcuts To see the current key configuration and its keyboard shortcuts, choose the Eclipse > Preferences menu command to open the Eclipse workbench Preferences. Select the General > Editor > Keys page.
CTRL+O in eclipse searches in current class/file. CTRL+F12 is the correct equivalent.
if you double-click just after the opening {
of a function, you will select the all function body.
You can then:
Of course, that is the shortcut you describe in your question, and moving a function by just one line can result in an incorrect code (as the function can end up within another one).
You have to repeat the shortcut the appropriate number of time to actually move the function before or after another one.
So the answer is: No, not exactly like IDEA, but close enough.
Actually, if the outline view is not sorted alphabetically, you can drag and drop a function in order to reorder them.
But that is not a shortcut.
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