Vfs listener is not notified.

Answered

Hi,

I tried to use

VirtualFileManager.getInstance().addAsyncFileListener

to listen to VFS change events. But the listener is not getting events unless I save manually by ctrl+s.

I compared with Git which will get changes almost immediately. And I think Git use `addAsyncFileListener` as well.

Does anyone know the reason?

 

 

5 comments
Comment actions Permalink

VFS does not reflect every change in editor.
You can subscribe for DocumentListener multicaster, <editorFactoryDocumentListener implementation=.../>.

0
Comment actions Permalink

But why Git can get events immediately? Does it use `DocumentListener` as well?

0
Comment actions Permalink

Like you said that VFS does not reflect every change in editor, how does Git can be notified almost immediately?

0
Comment actions Permalink

Like I said, by listening to DocumentListener and some other events (such as explicit notifications after performing vcs actions from IDE).

If you're interested in details, you can track VcsDirtyScopeManager usages, starting with FileStatusManagerImpl.FileStatusManagerDocumentListener and VcsDirtyScopeVfsListener.

0

Please sign in to leave a comment.