Action doesn't see changes in xml file
I modify xml file in write action (some rename action):
Then I read the xml file in next action (some delete action) through VirtualFile.getInputStream() and don't see changes done by 1st action!
P.S. If open the xml file after 1st action, save the xml file and run the 2nd action then the 2nd action sees changes.
Please advice how to flush file changes to disk after 1st action.
Please sign in to leave a comment.
Hello Alex,
Why do you use VirtualFile.getInputStream() rather than XmlFile.getText()?
If you do need to ensure that changes are saved to disk, you can use FileDocumentManager.saveDocument(FileDocumentManager.getDocument(VirtualFile)).
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
This fixes the problem.
Related question: Does Idea use PsiFile instances as cache (i.e. only one PsiFile in memory exists for each file in the project, or the PsiFile is created by request)?
Hello Alex,
Please refer to the following document for some explanations of this:
http://www.jetbrains.net/confluence/display/IDEADEV/IntelliJIDEA6.0ArchitecturalOverview
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"