views:

21

answers:

1

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?

A: 

I don not know of a way to mark regions and diff them in eclipse, but you can diff two files. In that way you might get what you are looking for by copying out the parts you want to diff in two paste files, at least 90%?

Select the two files you want to diff in the project tree and right-click -> select compare with -> each other.

cheers, Jørgen

rakke
I was kinda hoping to trigger someone to add this simple tool to some IDE, preferably Eclipse...
Thomas Nilsson