如何检测Intellij或Android stdio文件修改的“真实”实时? [英] How do I detect Intellij or Android stdio file modifications 'real' realtime?
问题描述
我正在为intellij想法写一个插件。
I am writing a plugin for intellij idea.
如何实时检测Intellij或Android stdio文件修改?
解决方案1: BulkFileListener
但是按 Ctrl + S 后有效。在没有ctrl + s的情况下添加或删除字符时,它无法报告此事件。
But it works after pressing Ctrl+S. When a character was added or deleted without ctrl+s, it cannot report this event.
解决方案2: TypedActionHandler
但它仅适用于添加字符。当一个字符或一行被删除时,它无法报告此事件。
But it only works for adding characters. When a character or a line was deleted, it cannot report this event.
以上两个不是我想要的。
还有其他任何建议吗?
推荐答案
要获得有关所有文档更改的通知,您可以使用 EditorFactory.getEventMulticaster()。addDocumentListener()
。
To get notifications about changes in all documents, you can use EditorFactory.getEventMulticaster().addDocumentListener()
.
这篇关于如何检测Intellij或Android stdio文件修改的“真实”实时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!