This post originated from an RSS feed registered with Java Buzz
by Vasanth Dharmaraj.
Original Post: Eclipse tip: Local History
Feed Title: Vasanth Dharmaraj's Blogs
Feed URL: /SyndicationService.asmx/GetRssCategory?categoryName=Technology%7CJava
Feed Description: my thoughts on dot net, java, linux, formula one, xbox gamming...(my java category)
Sometimes when I am editing a file I want to restore a change I previously made like
deleting a method. I can always use undo. But if I changed something after deleting
the method that I do not want to undo, things get a bit tricky. Eclipse has a elegant
solution for this. Eclipse keeps track of the changes to a file each time you save
it. These changes are stored as local history.
There are a few ways you can use the local history. You can compare the current contents
of the file with previous versions, restore part of or the complete file from the
previous version. The local history can be used form the context menus in package
explorer, navigator or Java editor.
The Java editor lets you compare or restore Java elements. So I can restore the deleted
method by choosing 'Local History>Restore from…' in the editors
context menu. The dialog lets you view all the deleted Java elements. I can pick the
one I want and click restore. That simple.
I can configure how much history I want to maintain. This configuration can be found
at Window>Preference>Workbench>Local History.