Listener for file changes.

Hi,

Can I have a ChangeListener (or maybe some other listener) to know whether a change was made outside of IntelliJ or via explicit editing from IntelliJ?

Is it possible to define listener for Save action in IntelliJ?

Thanks
Devang Shah

5 comments

Is it possible to define listener for Save action in
IntelliJ?


Catching save events:


File system listener:

0

Hi,

In SettingsSavingComponent, can I know which file(s) have been saved? Is it that all files open in the editor will be saved even if no contents are changed? I dont want to use VirtualFileSystem.addVirtualFileListener(VirtualFileListener).

Thanks
Devang Shah

0

Hello Dewang,

In SettingsSavingComponent, can I know which file(s) have been saved?
Is it that all files open in the editor will be saved even if no
contents are changed? I dont want to use
VirtualFileSystem.addVirtualFileListener(VirtualFileListener).


Well, addVirtualFileListener() is actually the correct API to use for this
purpose. With SettingsSavingComponent, you only know that some kind of a
save operation is being processed.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Hi Dmitry,

I know that some file has changed. Can I manually save the contents of this file to the file system? Or can I have a listener that gets invoked after the file has been changed only from IDE, besider VirtualFileListener?

0

Hello Dewang,

I know that some file has changed. Can I manually save the contents of
this file to the file system? Or can I have a listener that gets
invoked after the file has been changed, besider VirtualFileListener?


I still don't understand completely what exactly you need. But if you need
to save a modified document to the file system, you need to use FileDocumentManager.saveDocument().

Also you can refer to http://www.jetbrains.net/confluence/display/IDEADEV/IntelliJIDEA6.0ArchitecturalOverview
to get more information on the basic concepts of IntelliJ IDEA architecture.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.