Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to rearrange methods in Eclipse

Tags:

editor

eclipse

I am trying to keep functions related to each other close together. What would be the easiest way to rearrange methods within a class in Eclipse?

ALT+UP / ALT+DOWN works for code within methods, but moving the whole function around is a bit hard since it does not respect function boundaries.

Copy/Paste works, but I was hoping for something more elegant.

like image 697
Timur Fanshteyn Avatar asked Sep 02 '10 15:09

Timur Fanshteyn


2 Answers

In the outline view you can rearrange methods with the mouse.

like image 125
muksie Avatar answered Sep 30 '22 02:09

muksie


In the outline view you can drag and drop methods - you may need to unselect the alphabetic sort option.

Personally, I would not spend too much effort on re-ordering methods. I'd hope that your classes are small enough that it doesn't matter too much, and the outline view helps navigation too.

like image 22
djna Avatar answered Sep 30 '22 03:09

djna