public class PsiLocalVariableImpl extends CompositePsiElement implements PsiLocalVariable, PsiVariableEx
ourHC
EMPTY_ARRAY
FLAGS_LOCKED, ICON_PLACEHOLDER
EMPTY_ARRAY
EMPTY_ARRAY
EMPTY_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, replace
acceptTree, 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, textToCharArray
copyElement, equals, getElementType, getManager, getStartOffset, getStartOffsetInParent, getTextRange, getTreeNext, getTreeParent, getTreePrev, invalidate, onInvalidated, rawInsertAfterMe, rawInsertBeforeMe, rawRemove, rawRemoveUpTo, rawRemoveUpToLast, rawReplaceWithList, textMatches, textMatches, textMatches
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAnnotation, getAnnotations, hasAnnotation, hasModifier
getIdentifyingElement
getNavigationElement
isWritable
getCopyableUserData, putCopyableUserData
public void clearCaches()
clearCaches
in class CompositeElement
public final PsiIdentifier getNameIdentifier()
PsiVariable
getNameIdentifier
in interface PsiNameIdentifierOwner
getNameIdentifier
in interface PsiVariable
public final java.lang.String getName()
PsiNamedElement
getName
in interface NavigationItem
getName
in interface PomNamedTarget
getName
in interface PsiLocalVariable
getName
in interface PsiNamedElement
getName
in class CompositePsiElement
public void setInitializer(PsiExpression initializer) throws IncorrectOperationException
PsiLocalVariable
initializer
parameter is null, removes initializer from variable.setInitializer
in interface PsiLocalVariable
setInitializer
in interface PsiVariable
initializer
- the initializer to add.IncorrectOperationException
- if the modifications fails for some reason.public PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElement
setName
in interface PomRenameableTarget<PsiElement>
setName
in interface PsiNamedElement
setName
in interface PsiVariable
name
- 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()
PsiVariable
getType
in interface PsiVariable
public PsiTypeElement getTypeElement()
PsiLocalVariable
getTypeElement
in interface PsiLocalVariable
getTypeElement
in interface PsiVariable
public PsiModifierList getModifierList()
PsiModifierListOwner
getModifierList
in interface PsiModifierListOwner
public boolean hasModifierProperty(java.lang.String name)
PsiModifierListOwner
PsiModifier
class.hasModifierProperty
in interface PsiModifierListOwner
name
- the name of the modifier to check.public PsiExpression getInitializer()
PsiVariable
getInitializer
in interface PsiVariable
PsiVariable.hasInitializer()
public boolean hasInitializer()
PsiVariable
Checks 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 PsiVariable
public java.lang.Object computeConstantValue()
PsiVariable
computeConstantValue
in interface PsiVariable
public java.lang.Object computeConstantValue(java.util.Set<PsiVariable> visitedVars)
computeConstantValue
in interface PsiVariableEx
public int getTextOffset()
PsiElement
PsiNamedElement
, this should return the offset in the file of the
name identifier.)getTextOffset
in interface PsiElement
getTextOffset
in class TreeElement
public void normalizeDeclaration() throws IncorrectOperationException
PsiVariable
int[] a
)
and not in C style (int a[]
).normalizeDeclaration
in interface PsiVariable
IncorrectOperationException
- if the modification fails for some reason.public void deleteChildInternal(ASTNode child)
deleteChildInternal
in class CompositeElement
public ASTNode findChildByRole(int role)
findChildByRole
in class CompositeElement
public int getChildRole(ASTNode child)
getChildRole
in class CompositeElement
public void accept(PsiElementVisitor visitor)
PsiElement
accept
in interface PsiElement
accept
in class CompositePsiElement
visitor
- the visitor to pass the element to.public boolean processDeclarations(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place)
PsiElement
processDeclarations
in interface PsiElement
processDeclarations
in class CompositePsiElement
processor
- 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 NavigationItem
getPresentation
in class CompositePsiElement
public java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class CompositePsiElement
public SearchScope getUseScope()
PsiElement
getUseScope
in interface PsiElement
getUseScope
in class CompositePsiElement
PsiSearchHelper.getUseScope(PsiElement)
public javax.swing.Icon getElementIcon(int flags)
getElementIcon
in class ElementBase
protected boolean isVisibilitySupported()
isVisibilitySupported
in class ElementBase