Window > Preferences > General > Workspace > Refresh automaticallyThis should avoid "out of sync" happening. However if you get "out of sync" you can press F5 to refresh.
Programming Tips - Eclipse: Avoid getting the "out of sync" error in Eclipse
Date: 2011aug14
Update: 2025aug5
Product: Eclipse
Q. Eclipse: Avoid getting the "out of sync" error in Eclipse
A. This means the file on disk was modified at a different time than
the file Eclipse has in memory.
There is a option to auto-refresh: