- All Superinterfaces:
PsiElement
- All Known Subinterfaces:
PsiBinaryFile,PsiPlainTextFile
A PSI element representing a file.
Please see IntelliJ Platform Architectural Overview
for high-level overview.
- See Also:
-
com.intellij.openapi.actionSystem.LangDataKeys#PSI_FILEPsiElement.getContainingFile()PsiManager#findFile(VirtualFile)PsiDocumentManager#getPsiFile(com.intellij.openapi.editor.Document)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PsiFile[]The empty array of PSI files which can be reused to avoid unnecessary allocations. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidInvalidate any file-specific cache in this method.longGets the modification stamp value.@NotNull PsiFileIf the file is a non-physical copy of a file, returns the original file which had been copied.@NotNull PsiFile[]Deprecated.voidCalled by the PSI framework when the contents of the file changes.Methods inherited from interface com.intellij.psi.PsiElement
add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, getFirstChild, getLanguage, getLastChild, getNavigationElement, getNextSibling, getNode, getOriginalElement, getParent, getPrevSibling, getReference, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, isEquivalentTo, isPhysical, isValid, isWritable, replace, textContains, textMatches, textMatches, textToCharArray, toString
-
Field Details
-
EMPTY_ARRAY
The empty array of PSI files which can be reused to avoid unnecessary allocations.
-
-
Method Details
-
getModificationStamp
long getModificationStamp()Gets the modification stamp value. Modification stamp is a value changed by any modification of the content of the file. Note that it is not related to the file modification time.- Returns:
- the modification stamp value
- See Also:
-
VirtualFile#getModificationStamp()
-
getOriginalFile
If the file is a non-physical copy of a file, returns the original file which had been copied. Otherwise, returns the same file.- Returns:
- the original file of a copy, or the same file if the file is not a copy.
-
getPsiRoots
Deprecated.UseFileViewProvider#getAllFiles()instead.If the file contains multiple interspersed languages, returns the roots for PSI trees for each of these languages. (For example, a JSPX file contains JSP, XML and Java trees.)- Returns:
- the array of PSI roots, or a single-element array containing
thisif the file has only a single language.
-
subtreeChanged
void subtreeChanged()Called by the PSI framework when the contents of the file changes. If you override this method, you must call the base class implementation. While this method can be used to invalidate file-level caches, it is more much safe to invalidate them inclearCaches()since file contents can be reloaded completely (without any specific subtree change) without this method being called. -
clearCaches
default void clearCaches()Invalidate any file-specific cache in this method. It is called on file content change. If you override this method, you must call the base class implementation.
-
FileViewProvider#getAllFiles()instead.