...
To access a PSI tree within a PSI file, use File View Provider :
psiFile.getViewProvider().getPsi(language)
where the language
parameter specifies the programming language and takes values of the Language type defined in StdLanguages class. For example, to get the PSI tree for XML, use psiFile.getViewProvider().getPsi(StdLanguages.XML)
.
...
Most interesting modification operations are performed on the level of individual PSI elements, not files as a whole.
- To iterate over the elements in a PSI tree, use
psiFile.accept(new PsiRecursiveElementVisitor()...)
...
- To find a PSI element of a particular language at the specified offset in the PSI file, use
psiFile.getViewProvider().findElementAt(offset,language)
- To get child elements of a PSE tree in a particular language, use
psiFile.getViewProvider().getPsi(language).getChildren()
- To get child elements of a PSI element, use
psiElement.getChildren()
to be continued