How to diff two regions of the same file in Eclipse

Posted by Thomas Nilsson on Stack Overflow See other posts from Stack Overflow or by Thomas Nilsson
Published on 2010-05-12T10:56:19Z Indexed on 2010/05/12 11:14 UTC
Read the original article Hit count: 263

Filed under:
|
|
|

I'm a TDDer and often have a need to refactor out common or similar code. If it is exactly the same there is no big problem, Eclipse can almost always do that by itself. But to get there I'm finding myself often looking at similar, but not identical, code fragments in the same, or even different, files.

It would be very handy if there was a possibility to mark two regions and get Eclipse (or some other tool) to mark the differences. With this information it would be much simpler to iteratively move the regions closer until they are the same and then activate the Extract Method refactoring.

It can be done in Emacs of course, but I'd like to have this readily available from Eclipse. Any pointers?

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about refactor