views:

170

answers:

2

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)

+1  A: 

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.

VonC
A: 

If you can afford to use the mouse, you can do it from the outline view. That will be easiest.

fastcodejava