Save files in open tabs
I'm developing a plugin in CLion.
I have an Action which counts on the latest changes in the project's files. I thought to save all files which in open tabs before my action occurring.
Can you guide me on how to save files that are currently open?
Thanks.
Please sign in to leave a comment.
Query open files via com.intellij.openapi.fileEditor.FileEditorManager#getOpenFiles, obtain Document from com.intellij.openapi.fileEditor.FileDocumentManager#getDocument and then invoke com.intellij.openapi.fileEditor.FileDocumentManager#saveDocument
alternatively simply call com.intellij.openapi.fileEditor.FileDocumentManager#saveAllDocuments