在 Eclipse 上工作时,如果您在 Eclipse 之外更改任何文件,Eclipse 中会出现一个对话框,其中包含消息:
eclipse如何检测它?我认为 Eclipse 有某种监听器来检测文件系统中的文件已更改。我需要知道监听器 API。
提前致谢!
最佳答案
您正在寻找当文件系统上的工作区中的文件发生更改时检测更改、触发事件等的类。
来自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.
你可以尝试配置eclipse源来了解更详细的,可以引用here & here了解更多详情。
[win32 文件系统的实现:org.eclipse.core.internal.resources.refresh.win32.Win32RefreshProvider
]
您还可以通过扩展 RefreshProvider
并配置它来提供自定义刷新监视器,如链接中所示;希望这有帮助。
关于java - eclipse如何理解文件系统中的文件变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27423318/