Reputation: 771
While working on eclipse, if you change any file outside of eclipse, a dialog comes up in eclipse with message:
How eclipse detects it? I think eclipse has some kind of listeners to detect that the file has changed in file system. I need to know that listener API.
Thanks in advance!
Upvotes: 1
Views: 849
Reputation: 11602
You are looking for the class which detects changes, triggers the event etc. when file is changed in the workspace on the file system.
From documentation:
RefreshProvider#createPollingMonitor() Creates a new refresh monitor that performs naive polling of the resource in the file system to detect changes. The returned monitor will immediately begin monitoring the specified resource root and report changes back to the workspace.
You can try configuring eclipse source to understand more in detail, can refer here & here for more details.
[Implementation for win32 filesystem : org.eclipse.core.internal.resources.refresh.win32.Win32RefreshProvider
]
You can also provide custom refresh monitor by extending RefreshProvider
& configuring it as demonstrated in link; hope this helps.
Upvotes: 2