Over a million developers have joined DZone.

Eclipse Local History & Quick Diff

DZone's Guide to

Eclipse Local History & Quick Diff

· Java Zone
Free Resource

The single app analytics solutions to take your web and mobile apps to the next level.  Try today!  Brought to you in partnership with CA Technologies

I worked long hours on my project, and it was working well. But after a series of edits, somehow the application was not working the way it should. What did I change to break my code? Usually I smile, because I have things in a version control system. But: not this time (I should know better!). Luckily there are some ways to find out what has been changed: with the Local History and Quick Diff.

Local History

Even if not using a version control system, Eclipse has a local history built-in. To compare and diff with the history, I use the menu

Compare with Local History

Compare with Local History

This opens the History View which offers compare and merge (see Compare and Merge in Eclipse):

History View

History View

The number of entries (and size) of the local history is configured in the following workspace setting (menu Window > Preferences > General > Workspace > Local History):

Local History Preferences

Local History Preferences

Note: keeping a long history might slow down Eclipse, especially at workspace closure time (see CodeWarrior Tool Tip #3). So better not to keep too much of history.

Quick Diff

The Local History is nice, but there is even a faster way: Quick Diff!

Quick Diff can be enabled (if not already done) in the workspace settings (menu Window > Preferences > General > Editors > Text Editors > Quick Diff):

Quick Diff Preferences

Quick Diff Preferences

In the settings I can change the colors, and as well what to use as reference ((Version on Disk, Latest CVS Version  or Pristine SVN Copy).

Note: There seems to be a problem (oversight?) in Eclipse (at least 3.6) with using ‘Version on Disk’: With saving a file the Quick Diff markers are gone too :-( . But it works as expected with the SVN settings. Another good reason to use SVN :-) .

There is a general option to enable Quick Diff, and I have enabled as well the ‘Show differences in overview ruler’.

What it does: it shows the differences in the left editor area (where usually the line numbers are):

Quick Diff Color Marker

Quick Diff Color Marker

The colors are as configured in the Quick Diff preferences shown earlier.

If I move the mouse over the marker, a pop-up window shows up:

Quick Diff Mouse Over

Quick Diff Mouse Over

The first character in the pop up indicates what has changed:

  • >: changed line
  • +: inserted line
  • -: deleted line

Note the ‘Press ‘F2′ for focus’: That way I copy and restore my earlier version. Quick is simple and fast  and gives me an immediate access to the earlier version.

Happy Quick Diffing :-)

CA App Experience Analytics, a whole new level of visibility. Learn more. Brought to you in partnership with CA Technologies.


Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}