Timur Fanshteyn
Timur Fanshteyn

Reputation: 2306

Easiest way to rearrange methods in 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.

Upvotes: 15

Views: 3627

Answers (2)

djna
djna

Reputation: 55957

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.

Upvotes: 4

muksie
muksie

Reputation: 13063

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

Upvotes: 26

Related Questions