Publishers of technology books, eBooks, and videos for creative people
Programming is often a matter of writing code, making changes, adding, undoing, and trying old things again, until you've forgotten what's right and what's not. But by using Flash Builder's local history feature, going back in time to earlier versions of your code is no sweat!
A somewhat hidden but very useful feature in Flash Builder is its local history. Using this, you can see previous versions of a file so that you can compare, copy, and revert code from work that you had done before. To try it for yourself, after you've worked with a project so that there are some changes, revisions, and multiple saves, Right+Click (Windows) or Control+Click (Mac OS X) on a document. From the contextual menu, choose Compare With > Local History. This will open the History view (Figure 1).
In the History view, you can double-click on any of the timestamps to compare the current version of the active file to that version (both will appear side-by-side in the same editor window). In the upper-right corner of the window (Figure 2), the first two buttons will copy changes from the older file to the new one, without you having to copy and paste.
The first button copies all non-conflicting changes over; the second copies only the currently selected change, regardless of whether or not it conflicts with something in the newer file. The next four buttons are for navigating through the changes and differences, in both forward and reverse directions.
You can customize how local history works (somewhat) in the Flash Builder preferences. You'll find the corresponding settings under Preferences > General > Workspace > Local History. There are three settings you can set: for how many days history files should be kept, the maximum number of entries that should be kept per file, and the maximum allowed size for the history file.
If you know you'd rather revert the entire file to a previous version, you can bring up the contextual menu and select either Replace With > Local History or Replace With > Previous from Local History. The former will present a list of history points to revert back to; the latter automatically reverts to the previous point.