tags:

views:

21

answers:

2

I am trying to keep functions related to each other in close proximity to each other. 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.

+2  A: 

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

muksie
A: 

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.

djna