开发者

eclipse change member order shortcut (like intellij)

开发者 https://www.devze.com 2022-12-08 13:10 出处:网络
Intellij has a shortcut for moving the current method internally in the class ( I think it is Ctrl+Shift+{Up or Down Arrow})

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 t开发者_JAVA技巧o use the mouse (in the outline view where one may re-order members of a class)


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消