How to create com.intellij.psi.xml.XmlFile from com.intellij.openapi.vfs.Virtual file? Follow
How to create com.intellij.psi.xml.XmlFile from com.intellij.openapi.vfs.Virtual file?
Does my edits on newly created XmlFile will change actual file on the disk?
Please sign in to leave a comment.
See IntelliJ IDEA Architectural Overview.
1. You do not create PsiFile manually. Use PsiManager.getInstance(project).findFile()
2. Not immediately. In general you shouldn't care about file saving. It may be needed only before invoking some external process that uses the files. To force saving use FileDocumentManager.getInstance().saveAllDocuments() or ApplicationManager.getApplication().saveAll()
As suggested already, you can use the PsiManager.
Here is an extract from my plugin
DomManager.getDomProkect(project).getFileElement(xmlFile, RootDomElement.class)
You may find http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Architectural+Overview useful :)
Alan