Out of sync error in Eclipse

Problem

Eclipse has a strange behavior that I have not seen in any other editor or IDE. Assume that a file belonging to a project in the workspace has been modified outside of Eclipse. If you now open that file in Eclipse, it does not open it, but shows this error:

Resource is out of sync with the file system: '/src/foo.cpp'.

Press 'F5' or select File > Refresh to refresh the file.

You can press F5 and the file will be displayed.

Solution

I cannot imagine a scenario in practice where I would not want to keep the updated file. To make this out of sync error go away by refreshing files automatically, you have two options:

  1. You can make Eclipse refresh the file automatically when it is opened. To do this enable Windows -> Preferences -> General -> Workspace -> Refresh on access.

  2. You can make Eclipse refresh the file by being signaled by the filesystem (this is efficient) or polling the filesystem (this is inefficient). This is efficient only on Windows. To do this enable Windows -> Preferences -> General -> Workspace -> Refresh using native hooks or polling.

Tried with: Eclipse 4.5 and Ubuntu 14.04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s