Right click on the file and choose Replace with > Local History
. Eclipse should have several versions of the file available (although it may not have the very latest).
You can configure how much history Eclipse keeps in Preferences > General > Workspace > Local History
It may also be worth using a source control system like Git or SVN even if you don't share code with anyone just for the additional backup.