public class PsiLocalVariableImpl extends CompositePsiElement implements PsiLocalVariable, PsiVariableEx
ourHCEMPTY_ARRAYFLAGS_LOCKED, ICON_PLACEHOLDEREMPTY_ARRAYEMPTY_ARRAYEMPTY_NAVIGATION_ITEM_ARRAY| Constructor and Description |
|---|
PsiLocalVariableImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
void |
clearCaches() |
java.lang.Object |
computeConstantValue()
Calculates and returns the constant value of the variable initializer.
|
java.lang.Object |
computeConstantValue(java.util.Set<PsiVariable> visitedVars) |
void |
deleteChildInternal(ASTNode child) |
ASTNode |
findChildByRole(int role) |
int |
getChildRole(ASTNode child) |
javax.swing.Icon |
getElementIcon(int flags) |
PsiExpression |
getInitializer()
Returns the initializer for the variable.
|
PsiModifierList |
getModifierList()
Returns the list of modifiers for the element.
|
java.lang.String |
getName()
Returns the name of the element.
|
PsiIdentifier |
getNameIdentifier()
Returns the identifier declaring the name of the variable.
|
ItemPresentation |
getPresentation() |
int |
getTextOffset()
Returns the offset in the file to which the caret should be placed
when performing the navigation to the element.
|
PsiType |
getType()
Returns the type of the variable.
|
PsiTypeElement |
getTypeElement()
Returns the type element declaring the type of the variable.
|
SearchScope |
getUseScope()
Returns the scope in which references to this element are searched.
|
boolean |
hasInitializer()
Checks if the variable has an initializer.
|
boolean |
hasModifierProperty(java.lang.String name)
Checks if the element has the specified modifier.
|
protected boolean |
isVisibilitySupported() |
void |
normalizeDeclaration()
Ensures that the variable declaration is not combined in the same statement with
other declarations.
|
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 |
setInitializer(PsiExpression initializer)
Adds initializer to the variable declaration statement or, if
initializer
parameter is null, removes initializer from variable. |
PsiElement |
setName(java.lang.String name)
Renames the element.
|
java.lang.String |
toString()
toString() should never be presented to the user.
|
acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, checkAdd, checkDelete, clone, copy, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, getFirstChild, getLanguage, getLastChild, getNavigationElement, getNextSibling, getNode, getOriginalElement, getParent, getPrevSibling, getProject, getReference, getReferences, getResolveScope, isEquivalentTo, isPhysical, isValid, isWritable, navigate, replaceacceptTree, addChild, addChild, addChildren, addInternal, addLeaf, countChildren, createPsiNoLock, findChildByRoleAsPsiElement, findChildByType, findChildByType, findChildByType, findChildByType, findLeafElementAt, findPsiChildByType, findPsiChildByType, getCachedLength, getChars, getChildren, getChildrenAsPsiElements, getChildrenAsPsiElements, getChildRole, getFirstChildNode, getLastChildNode, getPsi, getPsi, getText, getTextLength, hc, rawAddChildren, rawAddChildrenWithoutNotifications, rawFirstChild, rawLastChild, rawRemoveAllChildren, removeAllChildren, removeChild, removeRange, replaceAllChildrenToChildrenOf, replaceChild, replaceChildInternal, setPsi, subtreeChanged, textContains, textMatches, textToCharArraycopyElement, equals, getElementType, getManager, getStartOffset, getStartOffsetInParent, getTextRange, getTreeNext, getTreeParent, getTreePrev, invalidate, onInvalidated, rawInsertAfterMe, rawInsertBeforeMe, rawRemove, rawRemoveUpTo, rawRemoveUpToLast, rawReplaceWithList, textMatches, textMatches, textMatchesbuildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, overlayIcons, registerIconLayer, transformFlagschangeUserMap, clearUserData, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMapfinalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAnnotation, getAnnotations, hasAnnotation, hasModifiergetIdentifyingElementgetNavigationElementisWritablegetCopyableUserData, putCopyableUserDatapublic void clearCaches()
clearCaches in class CompositeElementpublic final PsiIdentifier getNameIdentifier()
PsiVariablegetNameIdentifier in interface PsiNameIdentifierOwnergetNameIdentifier in interface PsiVariablepublic final java.lang.String getName()
PsiNamedElementgetName in interface NavigationItemgetName in interface PomNamedTargetgetName in interface PsiLocalVariablegetName in interface PsiNamedElementgetName in class CompositePsiElementpublic void setInitializer(PsiExpression initializer) throws IncorrectOperationException
PsiLocalVariableinitializer
parameter is null, removes initializer from variable.setInitializer in interface PsiLocalVariablesetInitializer in interface PsiVariableinitializer - the initializer to add.IncorrectOperationException - if the modifications fails for some reason.public PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElementsetName in interface PomRenameableTarget<PsiElement>setName in interface PsiNamedElementsetName in interface PsiVariablename - 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 final PsiType getType()
PsiVariablegetType in interface PsiVariablepublic PsiTypeElement getTypeElement()
PsiLocalVariablegetTypeElement in interface PsiLocalVariablegetTypeElement in interface PsiVariablepublic PsiModifierList getModifierList()
PsiModifierListOwnergetModifierList in interface PsiModifierListOwnerpublic boolean hasModifierProperty(java.lang.String name)
PsiModifierListOwnerPsiModifier class.hasModifierProperty in interface PsiModifierListOwnername - the name of the modifier to check.public PsiExpression getInitializer()
PsiVariablegetInitializer in interface PsiVariablePsiVariable.hasInitializer()public boolean hasInitializer()
PsiVariableChecks if the variable has an initializer.
Please note that even when PsiVariable.hasInitializer() returns true, PsiVariable.getInitializer() still can return null,
e.g. for implicit initializer in case of enum constant declaration.
hasInitializer in interface PsiVariablepublic java.lang.Object computeConstantValue()
PsiVariablecomputeConstantValue in interface PsiVariablepublic java.lang.Object computeConstantValue(java.util.Set<PsiVariable> visitedVars)
computeConstantValue in interface PsiVariableExpublic int getTextOffset()
PsiElementPsiNamedElement, this should return the offset in the file of the
name identifier.)getTextOffset in interface PsiElementgetTextOffset in class TreeElementpublic void normalizeDeclaration()
throws IncorrectOperationException
PsiVariableint[] a)
and not in C style (int a[]).normalizeDeclaration in interface PsiVariableIncorrectOperationException - if the modification fails for some reason.public void deleteChildInternal(ASTNode child)
deleteChildInternal in class CompositeElementpublic ASTNode findChildByRole(int role)
findChildByRole in class CompositeElementpublic int getChildRole(ASTNode child)
getChildRole in class CompositeElementpublic void accept(PsiElementVisitor visitor)
PsiElementaccept in interface PsiElementaccept in class CompositePsiElementvisitor - the visitor to pass the element to.public boolean processDeclarations(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place)
PsiElementprocessDeclarations in interface PsiElementprocessDeclarations in class CompositePsiElementprocessor - 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 ItemPresentation getPresentation()
getPresentation in interface NavigationItemgetPresentation in class CompositePsiElementpublic java.lang.String toString()
PsiElementtoString in interface PsiElementtoString in class CompositePsiElementpublic SearchScope getUseScope()
PsiElementgetUseScope in interface PsiElementgetUseScope in class CompositePsiElementPsiSearchHelper.getUseScope(PsiElement)public javax.swing.Icon getElementIcon(int flags)
getElementIcon in class ElementBaseprotected boolean isVisibilitySupported()
isVisibilitySupported in class ElementBase