|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PsiElement
The common base interface for all elements of the PSI tree.
| Field Summary | |
|---|---|
static PsiElement[] |
EMPTY_ARRAY
The empty array of PSI elements which can be reused to avoid unnecessary allocations. |
| Fields inherited from interface com.intellij.openapi.util.Iconable |
|---|
ICON_FLAG_CLOSED, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY |
| Method Summary | ||
|---|---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor. |
|
void |
acceptChildren(PsiElementVisitor visitor)
Passes the children of the element to the specified visitor. |
|
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. |
|
PsiElement |
addRange(PsiElement first,
PsiElement last)
Adds a range of elements as children to this PSI element. |
|
PsiElement |
addRangeAfter(PsiElement first,
PsiElement last,
PsiElement anchor)
Adds a range of elements as children to this PSI element, after the specified anchor element. |
|
PsiElement |
addRangeBefore(PsiElement first,
PsiElement last,
PsiElement anchor)
Adds a range of elements as children to this PSI element, before the specified anchor element. |
|
void |
checkAdd(PsiElement element)
Deprecated. not all PSI implementations implement this method correctly. |
|
void |
checkDelete()
Deprecated. not all PSI implementations implement this method correctly. |
|
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. |
|
void |
deleteChildRange(PsiElement first,
PsiElement last)
Deletes a range of children of 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. |
|
PsiElement[] |
getChildren()
Returns the array of children for the PSI element. |
|
PsiFile |
getContainingFile()
Returns the file containing the PSI element. |
|
PsiElement |
getContext()
Returns the element which should be used as the parent of this element in a tree up walk during a resolve operation. |
|
|
getCopyableUserData(Key<T> key)
Returns a copyable user data object attached to this element. |
|
PsiElement |
getFirstChild()
Returns the first child of the PSI element. |
|
Language |
getLanguage()
Returns the language of the PSI element. |
|
PsiElement |
getLastChild()
Returns the last child of the PSI element. |
|
PsiManager |
getManager()
Returns the PSI manager for the project to which the PSI element belongs. |
|
PsiElement |
getNavigationElement()
Returns the PSI element which should be used as a navigation target when navigation to this PSI element is requested. |
|
PsiElement |
getNextSibling()
Returns the next sibling of the PSI element. |
|
ASTNode |
getNode()
Returns the AST node corresponding to the element. |
|
PsiElement |
getOriginalElement()
Returns the PSI element which corresponds to this element and belongs to either the project source path or class path. |
|
PsiElement |
getParent()
Returns the parent of the PSI element. |
|
PsiElement |
getPrevSibling()
Returns the previous sibling of the PSI element. |
|
Project |
getProject()
Returns the project to which the PSI element belongs. |
|
PsiReference |
getReference()
Returns the reference associated with this PSI element. |
|
PsiReference[] |
getReferences()
Returns all references associated with this PSI element. |
|
GlobalSearchScope |
getResolveScope()
Returns the scope in which the declarations for the references in this PSI element are searched. |
|
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. |
|
SearchScope |
getUseScope()
Returns the scope in which references to this element are searched. |
|
boolean |
isPhysical()
Checks if an actual source or class file corresponds to the element. |
|
boolean |
isValid()
Checks if the PSI element corresponds to the current state of the underlying document. |
|
boolean |
isWritable()
Checks if the contents of the element can be modified (if it belongs to a non-read-only source file.) |
|
boolean |
processDeclarations(PsiScopeProcessor processor,
PsiSubstitutor substitutor,
PsiElement lastParent,
PsiElement place)
Passes the declarations contained in this PSI element and its children for processing to the specified scope processor. |
|
|
putCopyableUserData(Key<T> key,
T value)
Attaches a copyable user data object to this element. |
|
PsiElement |
replace(PsiElement newElement)
Replaces this PSI element (along with all its children) with another element (along with the children). |
|
boolean |
textContains(char c)
Checks if the text of this element contains the specified character. |
|
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. |
|
| Methods inherited from interface com.intellij.openapi.util.UserDataHolder |
|---|
getUserData, putUserData |
| Methods inherited from interface com.intellij.openapi.util.Iconable |
|---|
getIcon |
| Field Detail |
|---|
static final PsiElement[] EMPTY_ARRAY
| Method Detail |
|---|
Project getProject()
@NotNull Language getLanguage()
PsiManager getManager()
@NotNull PsiElement[] getChildren()
PsiElement getParent()
@Nullable PsiElement getFirstChild()
@Nullable PsiElement getLastChild()
@Nullable PsiElement getNextSibling()
@Nullable PsiElement getPrevSibling()
PsiFile getContainingFile()
TextRange getTextRange()
int getStartOffsetInParent()
int getTextLength()
PsiElement findElementAt(int offset)
offset - the relative offset for which the PSI element is requested.
@Nullable PsiReference findReferenceAt(int offset)
offset - the relative offset for which the reference is requested.
int getTextOffset()
PsiNamedElement, this should return the offset in the file of the
name identifier.)
java.lang.String getText()
@NotNull char[] textToCharArray()
PsiElement getNavigationElement()
this 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.)
PsiElement getOriginalElement()
this or substitute a different element if this element does
not belong to the source path or class path. (For example, the original
element for a library source file is the corresponding compiled class file.)
boolean textMatches(@NotNull
java.lang.CharSequence text)
text - the character sequence to compare with.
boolean textMatches(@NotNull
PsiElement element)
element - the element to compare the text with.
boolean textContains(char c)
c - the character to search for.
void accept(@NotNull
PsiElementVisitor visitor)
visitor - the visitor to pass the element to.
void acceptChildren(@NotNull
PsiElementVisitor visitor)
visitor - the visitor to pass the children to.PsiElement copy()
PsiElement add(@NotNull
PsiElement element)
throws IncorrectOperationException
element - the child element to add.
element or its copy).
IncorrectOperationException - if the modification is not supported or not possible for some reason.
PsiElement addBefore(@NotNull
PsiElement element,
PsiElement anchor)
throws IncorrectOperationException
element - 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.
PsiElement addAfter(@NotNull
PsiElement element,
PsiElement anchor)
throws IncorrectOperationException
element - 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.
void checkAdd(@NotNull
PsiElement element)
throws IncorrectOperationException
element - the child element to check the add possibility.
IncorrectOperationException - if the modification is not supported or not possible for some reason.
PsiElement addRange(PsiElement first,
PsiElement last)
throws IncorrectOperationException
first - the first child element to add.last - the last child element to add (must have the same parent as first)
first or its copy).
IncorrectOperationException - if the modification is not supported or not possible for some reason.
PsiElement addRangeBefore(PsiElement first,
PsiElement last,
PsiElement anchor)
throws IncorrectOperationException
first - the first child element to add.last - the last child element to add (must have the same parent as first)anchor - the anchor before which the child element is inserted (must be a child of this PSI element)
first or its copy).
IncorrectOperationException - if the modification is not supported or not possible for some reason.
PsiElement addRangeAfter(PsiElement first,
PsiElement last,
PsiElement anchor)
throws IncorrectOperationException
first - the first child element to add.last - the last child element to add (must have the same parent as first)anchor - the anchor after which the child element is inserted (must be a child of this PSI element)
first or its copy).
IncorrectOperationException - if the modification is not supported or not possible for some reason.
void delete()
throws IncorrectOperationException
IncorrectOperationException - if the modification is not supported
or not possible for some reason (for example, the file containing the element is read-only).
void checkDelete()
throws IncorrectOperationException
IncorrectOperationException - if the modification is not supported or not possible for some reason.
void deleteChildRange(PsiElement first,
PsiElement last)
throws IncorrectOperationException
first - the first child to delete (must be a child of this PSI element)last - the last child to delete (must be a child of this PSI element)
IncorrectOperationException - if the modification is not supported or not possible for some reason.
PsiElement replace(@NotNull
PsiElement newElement)
throws IncorrectOperationException
newElement - the element to replace this element with.
newElement or its copy)
IncorrectOperationException - if the modification is not supported or not possible for some reason.boolean isValid()
boolean isWritable()
@Nullable PsiReference getReference()
getReferences() for an example), returns the first
associated reference.
@NotNull PsiReference[] getReferences()
PsiPolyVariantReference should be used instead
of returning multiple references.
<T> T getCopyableUserData(Key<T> key)
key - the key for accessing the user data object.
putCopyableUserData(com.intellij.openapi.util.Key, Object)
<T> void putCopyableUserData(Key<T> key,
T value)
key - the key for accessing the user data object.value - the user data object to attach.getCopyableUserData(com.intellij.openapi.util.Key)
boolean processDeclarations(PsiScopeProcessor processor,
PsiSubstitutor substitutor,
PsiElement lastParent,
PsiElement place)
processor - the processor receiving the declarations.substitutor - the class providing the mapping between type parameters and their values.lastParent - the child of this element which was 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.
PsiElement getContext()
getParent(),
but the context can be overridden for some elements like code fragments (see
PsiElementFactory.createCodeBlockCodeFragment(String, PsiElement, boolean)).
boolean isPhysical()
PsiDocumentManager.getDocument(PsiFile) returns null for non-physical elements.
GlobalSearchScope getResolveScope()
@NotNull SearchScope getUseScope()
PsiSearchHelper.getUseScope(PsiElement).
ASTNode getNode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||