There is this check box on Eclipse:
Preferences -> General -> Workspace -> Refresh using native hooks or polling
The Eclipse documentation says:
If this option is turned on then the workspace resources will be synchronized with their corresponding resources in the file system automatically using native refresh providers (on Windows) or a polling mechanism.
From the documentation and the check box description suggest that there is some sort of OS hook that Eclipse uses to get notifications about file changes. And it seems that this feature is emulated on OSes other than Windows using polling.
My questions are:
Yes, this is really what Eclipse is doing. For Mac or Linux it currently uses polling.
There is an extension point org.eclipse.core.resources.refreshProviders
that can be used to provide the refresh code for each platform and people have written test plugins for Mac and Linux but they are not in the product (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=108697 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=237344 )
Source for this is org.eclipse.core.internal.refresh.MonitorManager
, PollingMonitor
does the polling refresh.
org.eclipse.core.internal.resources.refresh.win32.Win32RefreshProvider
does the Windows refresh using native methods via JNI (it is in a Windows only plugin).
org.eclipse.core.internal.resources.refresh.win32.Win32Monitor
and Win32Natives
contain the core code.
I have found out that the option "Refresh using native hooks or polling" was the original way of doing this:
Previous Eclipse versions relied on native refresh providers (on Windows) or a polling mechanism to keep the workspace synchronized with the underlying filesystem. This capability can be still enabled by selecting Refresh using native hooks or polling on Opens the preference page Preferences > General > Workspace.
Now a new lightweight mechanism is available. Files discovered to be out-of-sync by the workspace, for example while accessing the file content by an editor, will be automatically asynchronously refreshed. If you want to refresh files this way, go to Opens the preference page Preferences > General > Workspace and select Refresh on access.
From now on I'll go only with Refresh on access.
"Refresh using native hooks or polling" can solve the problem about project building is not updated when files are edited using external editors. problem details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With