As You Explained you are in File → Local History → Show History so in left you can see the changers you made and in right you can see the code
If it is the last delete you can right click on Delete and revert but this will revert all changes you did after the delete
The second way is to get a patch file or copy the cord manully > create a class > paste the code