by, 11-10-2011 at 06:24 PM (939 Views)
While working on projects, sometimes you wish to see the changes you made since last version of the file. This is important to rollback changes or simple to know what new has been added or what has been removed. Eclipse provides a useful feature for this very purpose. In this post, I will write about compare feature.
Whenever you save a Java file, Eclipse keep a copy of the older one if this feature is enabled. This is required for comparing files in case you need that. To view the history of a Java class, simply right click the file and click Show in > History. You will be shown all the revision times of the Java class.
To compare the current Java class with some old version, right click the class and choose Compare with > Local history. Now you have to choose the version of the file with which you want to compare. After choosing, you will be shown both files in a window like this:
The added code will be highlighted. You make rollback the changes if you want.
Comparing files is a simple but useful feature provided by Eclipse. Explore it and use it when needed.