java - eclipse如何理解文件系统中的文件变化?

标签 java eclipse eclipse-plugin listener

在 Eclipse 上工作时,如果您在 Eclipse 之外更改任何文件,Eclipse 中会出现一个对话框,其中包含消息:

enter image description here

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/

相关文章:

java - PDF 渲染器库中的缩放选项

Java:带有长类型参数的 String.substring()

java - 运行DLL中声明的方法的代码

java - 如何安排任务以定期间隔运行?

java:如何查找初始值为零并出现错误 "/by zero"的值

java - STS 启动仪表板不显示起始端口

java - 将新图像添加到资源文件夹后出现类未找到异常

c++ - 在 Eclipse 中安装插件

java - Eclipse .class 大纲查看器

eclipse - 在 Eclipse 中将项目更新为 Git