public abstract class ClsElementImpl extends PsiElementBase implements PsiCompiledElement
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ClsElementImpl.InvalidMirrorException |
Iconable.IconFlags, Iconable.LastComputedIcon| Modifier and Type | Field and Description |
|---|---|
static Key<PsiCompiledElement> |
COMPILED_ELEMENT |
protected static java.lang.String |
NEXT_LINE |
FLAGS_LOCKED, ICON_PLACEHOLDERARRAY_FACTORY, EMPTY_ARRAYICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITYEMPTY_NAVIGATABLE_ELEMENT_ARRAYEMPTY_NAVIGATION_ITEM_ARRAY| Constructor and Description |
|---|
ClsElementImpl() |
| Modifier and Type | Method and Description |
|---|---|
PsiElement |
add(PsiElement element)
Adds a child to this PSI element.
|
PsiElement |
addAfter(PsiElement element,
PsiElement anchor)
Adds a child to this PSI element, after the specified anchor element.
|
PsiElement |
addBefore(PsiElement element,
PsiElement anchor)
Adds a child to this PSI element, before the specified anchor element.
|
abstract void |
appendMirrorText(int indentLevel,
java.lang.StringBuilder buffer) |
protected static void |
appendText(PsiElement stub,
int indentLevel,
java.lang.StringBuilder buffer) |
protected static void |
appendText(PsiElement stub,
int indentLevel,
java.lang.StringBuilder buffer,
java.lang.String separator) |
void |
checkAdd(PsiElement element)
Checks if it is possible to add the specified element as a child to this element,
and throws an exception if the add is not possible.
|
void |
checkDelete()
Checks if it is possible to delete the specified element from the tree,
and throws an exception if the add is not possible.
|
PsiElement |
copy()
Creates a copy of the file containing the PSI element and returns the corresponding
element in the created copy.
|
void |
delete()
Deletes this PSI element from the tree.
|
PsiElement |
findElementAt(int offset)
Finds a leaf PSI element at the specified offset from the start of the text range of this node.
|
PsiReference |
findReferenceAt(int offset)
Finds a reference at the specified offset from the start of the text range of this node.
|
protected PsiElement [] |
getChildren(PsiElement... children) |
PsiFile |
getContainingFile()
Returns the file containing the PSI element.
|
protected int |
getIndentSize() |
Language |
getLanguage()
Returns the language of the PSI element.
|
PsiManager |
getManager()
Returns the PSI manager for the project to which the PSI element belongs.
|
PsiElement |
getMirror()
Returns the corresponding PSI element in a decompiled file created by the IDE from
the library element.
|
ASTNode |
getNode()
Returns the AST node corresponding to the element.
|
int |
getStartOffsetInParent()
Returns the text offset of the PSI element relative to its parent.
|
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 |
isPhysical()
Checks if an actual source or class file corresponds to the element.
|
boolean |
isValid()
Checks if this PSI element is valid.
|
boolean |
isWritable()
Checks if the contents of the element can be modified (if it belongs to a
non-read-only source file.)
|
PsiElement |
replace(PsiElement newElement)
Replaces this PSI element (along with all its children) with another element
(along with the children).
|
abstract void |
setMirror(TreeElement element) |
protected static <T extends PsiElement> |
setMirror(T stub,
T mirror) |
protected void |
setMirrorCheckingType(TreeElement element,
IElementType type) |
protected static <T extends PsiElement> |
setMirrorIfPresent(T stub,
T mirror) |
protected static <T extends PsiElement> |
setMirrors(java.util.List<? extends T> stubs,
java.util.List<? extends T> mirrors) |
protected static <T extends PsiElement> |
setMirrors(T [] stubs,
T [] mirrors) |
boolean |
textMatches(java.lang.CharSequence text)
Checks if the text of this PSI element is equal to the specified character sequence.
|
boolean |
textMatches(PsiElement element)
Checks if the text of this PSI element is equal to the text of the specified PSI element.
|
char [] |
textToCharArray()
Returns the text of the PSI element as a character array.
|
accept, acceptChildren, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, getContext, getFirstChild, getLastChild, getName, getNavigationElement, getNextSibling, getOriginalElement, getPresentation, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getUseScope, isEquivalentTo, navigate, notNullChild, processDeclarations, 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, toString, wait, wait, waitaccept, acceptChildren, addRange, addRangeAfter, addRangeBefore, deleteChildRange, getChildren, getContext, getCopyableUserData, getFirstChild, getLastChild, getNavigationElement, getNextSibling, getOriginalElement, getOwnReferences, getParent, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getTextRangeInParent, getUseScope, isEquivalentTo, processDeclarations, putCopyableUserData, textContains, toStringgetUserData, putUserDatapublic static final Key<PsiCompiledElement> COMPILED_ELEMENT
protected static final java.lang.String NEXT_LINE
public Language getLanguage()
PsiElementgetLanguage in interface PsiElementpublic PsiManager getManager()
PsiElementgetManager in interface PsiElementgetManager in class PsiElementBasepublic PsiFile getContainingFile()
PsiElementgetContainingFile in interface PsiElementgetContainingFile in class PsiElementBasepublic final boolean isWritable()
PsiElementisWritable in interface PsiElementisWritable in class PsiElementBasepublic boolean isPhysical()
PsiElementPsiDocumentManager.getDocument(PsiFile) returns null for non-physical elements.
Not to be confused with FileViewProvider.isPhysical().isPhysical in interface PsiElementisPhysical in class PsiElementBasepublic 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 PsiElementBasePsiUtilCore.ensureValid(PsiElement)public PsiElement copy()
PsiElementcopy in interface PsiElementcopy in class PsiElementBaseprotected PsiElement [] getChildren(PsiElement... children)
public void checkAdd(PsiElement element) throws IncorrectOperationException
PsiElementcheckAdd in interface PsiElementcheckAdd in class PsiElementBaseelement - the child element to check the add possibility.IncorrectOperationException - if the modification is not supported or not possible for some reason.public PsiElement add(PsiElement element) throws IncorrectOperationException
PsiElementadd in interface PsiElementadd in class PsiElementBaseelement - the child element to add.element or its copy).IncorrectOperationException - if the modification is not supported or not possible for some reason.public PsiElement addBefore(PsiElement element, PsiElement anchor) throws IncorrectOperationException
PsiElementaddBefore in interface PsiElementaddBefore in class PsiElementBaseelement - the child element to add.anchor - the anchor before which the child element is inserted (must be a child of this PSI element)element or its copy).IncorrectOperationException - if the modification is not supported or not possible for some reason.public PsiElement addAfter(PsiElement element, PsiElement anchor) throws IncorrectOperationException
PsiElementaddAfter in interface PsiElementaddAfter in class PsiElementBaseelement - the child element to add.anchor - the anchor after which the child element is inserted (must be a child of this PSI element)element or its copy).IncorrectOperationException - if the modification is not supported or not possible for some reason.public void delete()
throws IncorrectOperationException
PsiElementdelete in interface PsiElementdelete in class PsiElementBaseIncorrectOperationException - if the modification is not supported
or not possible for some reason (for example, the file containing the element is read-only).public void checkDelete()
throws IncorrectOperationException
PsiElementcheckDelete in interface PsiElementcheckDelete in class PsiElementBaseIncorrectOperationException - if the modification is not supported or not possible for some reason.public PsiElement replace(PsiElement newElement) throws IncorrectOperationException
PsiElementreplace in interface PsiElementreplace in class PsiElementBasenewElement - the element to replace this element with.newElement or its copy)IncorrectOperationException - if the modification is not supported or not possible for some reason.public abstract void appendMirrorText(int indentLevel,
java.lang.StringBuilder buffer)
protected int getIndentSize()
public abstract void setMirror(TreeElement element) throws ClsElementImpl.InvalidMirrorException
public PsiElement getMirror()
PsiCompiledElementgetMirror in interface PsiCompiledElementpublic final TextRange getTextRange()
PsiElementgetTextRange in interface PsiElementpublic final int getStartOffsetInParent()
PsiElementgetStartOffsetInParent in interface PsiElementpublic int getTextLength()
PsiElementgetTextLength in interface PsiElementpublic PsiElement findElementAt(int offset)
PsiElementfindElementAt in interface PsiElementoffset - 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 PsiElementpublic java.lang.String getText()
PsiElementgetText in interface PsiElementPsiElement.textMatches(java.lang.CharSequence),
PsiElement.textContains(char)public char [] textToCharArray()
PsiElementtextToCharArray in interface PsiElementpublic boolean textMatches(java.lang.CharSequence text)
PsiElementtextMatches in interface PsiElementtextMatches in class PsiElementBasetext - the character sequence to compare with.public boolean textMatches(PsiElement element)
PsiElementtextMatches in interface PsiElementtextMatches in class PsiElementBaseelement - the element to compare the text with.public ASTNode getNode()
PsiElementgetNode in interface PsiElementprotected static void appendText(PsiElement stub, int indentLevel, java.lang.StringBuilder buffer)
protected static void appendText(PsiElement stub, int indentLevel, java.lang.StringBuilder buffer, java.lang.String separator)
protected void setMirrorCheckingType(TreeElement element, IElementType type) throws ClsElementImpl.InvalidMirrorException
protected static <T extends PsiElement> void setMirror(T stub, T mirror) throws ClsElementImpl.InvalidMirrorException
protected static <T extends PsiElement> void setMirrorIfPresent(T stub, T mirror) throws ClsElementImpl.InvalidMirrorException
protected static <T extends PsiElement> void setMirrors(T [] stubs, T [] mirrors) throws ClsElementImpl.InvalidMirrorException
protected static <T extends PsiElement> void setMirrors(java.util.List<? extends T> stubs, java.util.List<? extends T> mirrors) throws ClsElementImpl.InvalidMirrorException