Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse change member order shortcut (like intellij)

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)

like image 454
Nils Otto Avatar asked Oct 12 '09 16:10

Nils Otto


People also ask

Can we use IntelliJ shortcuts in Eclipse?

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!)

How do I make IntelliJ shortcuts like Eclipse?

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!

How do I change keyboard shortcuts in Eclipse?

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.

What is Ctrl O in Eclipse?

CTRL+O in eclipse searches in current class/file. CTRL+F12 is the correct equivalent.


1 Answers

if you double-click just after the opening { of a function, you will select the all function body.

You can then:

  • Alt+Up: to move the function up one line
  • Alt+Down: to move the function down one line

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.

like image 151
VonC Avatar answered Sep 17 '22 21:09

VonC