public class ClsFileImpl extends PsiBinaryFileImpl implements PsiJavaFile, PsiFileWithStubSupport, PsiFileEx, Queryable, PsiClassOwnerEx, PsiCompiledFile
Queryable.Contributor, Queryable.PrintInfo, Queryable.Util| Modifier and Type | Field and Description |
|---|---|
static Attribute[] |
EMPTY_ATTRIBUTES |
FLAGS_LOCKED, ICON_PLACEHOLDERBATCH_REFERENCE_PROCESSING| Constructor and Description |
|---|
ClsFileImpl(FileViewProvider viewProvider) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
void |
appendMirrorText(int indentLevel,
java.lang.StringBuilder buffer)
Deprecated.
Shouldn't be called from outside or overridden
|
static PsiJavaFileStub |
buildFileStub(VirtualFile file,
byte [] bytes) |
void |
checkSetName(java.lang.String name)
Checks if it is possible to rename the element to the specified name,
and throws an exception if the rename is not possible.
|
static java.lang.CharSequence |
decompile(VirtualFile file) |
PsiElement |
findElementAt(int offset)
Finds a leaf PSI element at the specified offset from the start of the text range of this node.
|
PsiJavaCodeReferenceElement |
findImportReferenceTo(PsiClass aClass)
Returns the single-class import statement which references
the specified class, or null if there is no such statement.
|
PsiReference |
findReferenceAt(int offset)
Finds a reference at the specified offset from the start of the text range of this node.
|
PsiFile |
getCachedMirror() |
PsiElement [] |
getChildren()
Returns the array of children for the PSI element.
|
PsiClass [] |
getClasses() |
java.util.Set<java.lang.String> |
getClassNames() |
PsiFile |
getContainingFile()
Returns the file containing the PSI element.
|
PsiFile |
getDecompiledPsiFile() |
PsiJavaCodeReferenceElement [] |
getImplicitlyImportedPackageReferences()
returns the list of reference elements for the
implicitly imported packages (for example, java.lang).
|
java.lang.String [] |
getImplicitlyImportedPackages()
Returns the list of names of implicitly imported packages
(for example, java.lang).
|
PsiImportList |
getImportList()
Returns the import list contained in the file.
|
Language |
getLanguage()
Returns the language of the PSI element.
|
LanguageLevel |
getLanguageLevel() |
PsiElement |
getMirror()
Returns the corresponding PSI element in a decompiled file created by the IDE from
the library element.
|
PsiJavaModule |
getModuleDeclaration()
Returns a Java module declaration element, or
null if the file is not a module-info one. |
PsiElement |
getNavigationElement()
Returns the PSI element which should be used as a navigation target
when navigation to this PSI element is requested.
|
PsiElement [] |
getOnDemandImports(boolean includeImplicit,
boolean checkIncludes)
Returns the list of classes or packages which have been
imported on demand (for example, javax.swing.*)
|
java.lang.String |
getPackageName()
Returns the name of the package to which the file belongs.
|
PsiPackageStatement |
getPackageStatement()
Returns the package statement contained in the file.
|
PsiClass [] |
getSingleClassImports(boolean checkIncludes)
Returns the list of classes which have been imported as
single-class imports.
|
int |
getStartOffsetInParent()
Returns the text offset of the PSI element relative to its parent.
|
PsiClassHolderFileStub<?> |
getStub() |
StubbedSpine |
getStubbedSpine() |
StubTree |
getStubTree() |
java.lang.String |
getText()
Returns the text of the PSI element.
|
int |
getTextLength()
Returns the length of text of the PSI element.
|
int |
getTextOffset()
Returns the offset in the file to which the caret should be placed
when performing the navigation to the element.
|
TextRange |
getTextRange()
Returns the text range in the document occupied by the PSI element.
|
boolean |
importClass(PsiClass aClass)
Adds an import statement for importing the specified class.
|
boolean |
isContentsLoaded() |
boolean |
isValid()
Checks if this PSI element is valid.
|
void |
onContentReload() |
boolean |
processDeclarations(PsiScopeProcessor processor,
ResolveState state,
PsiElement lastParent,
PsiElement place)
Passes the declarations contained in this PSI element and its children
for processing to the specified scope processor.
|
void |
putInfo(java.util.Map<java.lang.String,java.lang.String> info) |
void |
setMirror(TreeElement element)
Deprecated.
Shouldn't be called from outside or overridden
|
PsiElement |
setName(java.lang.String name)
Renames the element.
|
void |
setPackageName(java.lang.String packageName) |
char [] |
textToCharArray()
Returns the text of the PSI element as a character array.
|
java.lang.String |
toString()
toString() should never be presented to the user.
|
add, addAfter, addBefore, checkAdd, checkDelete, copy, delete, getContainingDirectory, getContext, getFileType, getManager, getModificationStamp, getName, getNode, getOriginalFile, getParent, getParentDirectory, getPsiRoots, getViewProvider, getVirtualFile, isDirectory, isPhysical, isWritable, markInvalidated, processChildren, replace, subtreeChanged, textMatches, textMatchesacceptChildren, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, getFirstChild, getLastChild, getNextSibling, getOriginalElement, getPresentation, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getUseScope, isEquivalentTo, navigate, notNullChild, textContainsbuildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getElementIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, overlayIcons, registerIconLayer, transformFlagschangeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMapequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitmarkInvalidatedpublic ClsFileImpl(FileViewProvider viewProvider)
public PsiFile getContainingFile()
PsiElementgetContainingFile in interface PsiElementgetContainingFile in class PsiBinaryFileImplpublic boolean isValid()
PsiElementPsiDocumentManager.commitDocument(com.intellij.openapi.editor.Document)).
(In this case an attempt to change PSI will result in an exception).
Any access to invalid elements results in PsiInvalidElementAccessException.
Once invalid, elements can't become valid again.
Elements become invalid in following cases:
PsiElement.delete())isValid in interface PsiElementisValid in class PsiBinaryFileImplPsiUtilCore.ensureValid(PsiElement)public Language getLanguage()
PsiElementgetLanguage in interface PsiElementgetLanguage in class PsiBinaryFileImplpublic PsiElement [] getChildren()
PsiElementgetChildren in interface PsiElementgetChildren in class PsiBinaryFileImplpublic PsiClass [] getClasses()
getClasses in interface PsiClassOwnerpublic PsiPackageStatement getPackageStatement()
PsiJavaFilegetPackageStatement in interface PsiJavaFilepublic java.lang.String getPackageName()
PsiJavaFilegetPackageName in interface PsiClassOwnergetPackageName in interface PsiJavaFilepublic void setPackageName(java.lang.String packageName)
throws IncorrectOperationException
setPackageName in interface PsiClassOwnerIncorrectOperationExceptionpublic PsiImportList getImportList()
PsiJavaFilegetImportList in interface PsiJavaFilepublic boolean importClass(PsiClass aClass)
PsiImportHolderimportClass in interface PsiImportHolderaClass - the class to import.public PsiElement [] getOnDemandImports(boolean includeImplicit, boolean checkIncludes)
PsiJavaFilegetOnDemandImports in interface PsiJavaFileincludeImplicit - if true, implicitly imported packages (like java.lang) are included.checkIncludes - deprecated, no longer usedpublic PsiClass [] getSingleClassImports(boolean checkIncludes)
PsiJavaFilegetSingleClassImports in interface PsiJavaFilecheckIncludes - deprecated, no longer used.public java.lang.String [] getImplicitlyImportedPackages()
PsiJavaFilegetImplicitlyImportedPackages in interface PsiJavaFilepublic java.util.Set<java.lang.String> getClassNames()
getClassNames in interface PsiClassOwnerExpublic PsiJavaCodeReferenceElement [] getImplicitlyImportedPackageReferences()
PsiJavaFilegetImplicitlyImportedPackageReferences in interface PsiJavaFilepublic PsiJavaCodeReferenceElement findImportReferenceTo(PsiClass aClass)
PsiJavaFilefindImportReferenceTo in interface PsiJavaFileaClass - the class to return the import statement for.public LanguageLevel getLanguageLevel()
getLanguageLevel in interface PsiJavaFilepublic PsiJavaModule getModuleDeclaration()
PsiJavaFilenull if the file is not a module-info one.getModuleDeclaration in interface PsiJavaFilepublic PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElementsetName in interface PsiNamedElementsetName in class PsiBinaryFileImplname - the new element name.this
or a different element if the rename caused the element to be replaced).IncorrectOperationException - if the modification is not supported or not possible for some reason.public void checkSetName(java.lang.String name)
throws IncorrectOperationException
PsiCheckedRenameElementcheckSetName in interface PsiCheckedRenameElementcheckSetName in class PsiBinaryFileImplname - the new name to check the renaming possibility for.IncorrectOperationException - if the rename is not supported or not possible for some reason.@Deprecated
public void appendMirrorText(int indentLevel,
java.lang.StringBuilder buffer)
@Deprecated public void setMirror(TreeElement element) throws ClsElementImpl.InvalidMirrorException
public PsiElement getNavigationElement()
PsiElementthis or substitute a different element if this element
does not have an associated file and offset. (For example, if the source code
of a library is attached to a project, the navigation element for a compiled
library class is its source class.)getNavigationElement in interface PsiElementgetNavigationElement in class PsiElementBasepublic PsiElement getMirror()
PsiCompiledElementgetMirror in interface PsiCompiledElementpublic java.lang.String getText()
PsiElementgetText in interface PsiElementgetText in class PsiBinaryFileImplPsiElement.textMatches(java.lang.CharSequence),
PsiElement.textContains(char)public int getTextLength()
PsiElementgetTextLength in interface PsiElementgetTextLength in class PsiBinaryFileImplpublic PsiFile getDecompiledPsiFile()
getDecompiledPsiFile in interface PsiCompiledFilepublic PsiFile getCachedMirror()
public void accept(PsiElementVisitor visitor)
PsiElementaccept in interface PsiElementaccept in class PsiBinaryFileImplvisitor - the visitor to pass the element to.public java.lang.String toString()
PsiElementtoString in interface PsiElementtoString in class PsiBinaryFileImplpublic final TextRange getTextRange()
PsiElementgetTextRange in interface PsiElementgetTextRange in class PsiBinaryFileImplpublic final int getStartOffsetInParent()
PsiElementgetStartOffsetInParent in interface PsiElementgetStartOffsetInParent in class PsiBinaryFileImplpublic final PsiElement findElementAt(int offset)
PsiElementfindElementAt in interface PsiElementfindElementAt in class PsiBinaryFileImploffset - the relative offset for which the PSI element is requested.public PsiReference findReferenceAt(int offset)
PsiElementfindReferenceAt in interface PsiElementfindReferenceAt in class PsiElementBaseoffset - the relative offset for which the reference is requested.public final int getTextOffset()
PsiElementPsiNamedElement, this should return the offset in the file of the
name identifier.)getTextOffset in interface PsiElementgetTextOffset in class PsiBinaryFileImplpublic char [] textToCharArray()
PsiElementtextToCharArray in interface PsiElementtextToCharArray in class PsiBinaryFileImplpublic PsiClassHolderFileStub<?> getStub()
public boolean processDeclarations(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place)
PsiElementprocessDeclarations in interface PsiElementprocessDeclarations in class PsiElementBaseprocessor - the processor receiving the declarations.lastParent - the child of this element has been processed during the previous
step of the tree up walk (declarations under this element do not need
to be processed again)place - the original element from which the tree up walk was initiated.public StubTree getStubTree()
getStubTree in interface PsiFileWithStubSupportPsiElement.getNode() or PsiElement.getText().public StubbedSpine getStubbedSpine()
getStubbedSpine in interface PsiFileWithStubSupportpublic boolean isContentsLoaded()
isContentsLoaded in interface PsiFileExisContentsLoaded in class PsiBinaryFileImplpublic void onContentReload()
onContentReload in interface PsiFileExonContentReload in class PsiBinaryFileImplpublic void putInfo(java.util.Map<java.lang.String,java.lang.String> info)
putInfo in interface QueryableputInfo in class PsiBinaryFileImplpublic static java.lang.CharSequence decompile(VirtualFile file)
public static PsiJavaFileStub buildFileStub(VirtualFile file, byte [] bytes) throws ClsFormatException
ClsFormatException