public abstract class LightVariableBase extends LightElement implements PsiVariable, OriginInfoAwareElement
Iconable.IconFlags, Iconable.LastComputedIcon| Modifier and Type | Field and Description |
|---|---|
protected PsiModifierList |
myModifierList |
protected PsiIdentifier |
myNameIdentifier |
protected PsiElement |
myScope |
protected PsiType |
myType |
protected boolean |
myWritable |
myManagerFLAGS_LOCKED, ICON_PLACEHOLDEREMPTY_ARRAYARRAY_FACTORYICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITYEMPTY_ARRAYEMPTY_NAVIGATABLE_ELEMENT_ARRAYEMPTY_NAVIGATION_ITEM_ARRAY| Constructor and Description |
|---|
LightVariableBase(PsiManager manager,
PsiIdentifier nameIdentifier,
Language language,
PsiType type,
boolean writable,
PsiElement scope) |
LightVariableBase(PsiManager manager,
PsiIdentifier nameIdentifier,
PsiType type,
boolean writable,
PsiElement scope) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
computeConstantValue()
Calculates and returns the constant value of the variable initializer.
|
protected PsiType |
computeType() |
protected PsiModifierList |
createModifierList() |
PsiElement |
getDeclarationScope() |
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.
|
java.lang.String |
getOriginInfo() |
java.lang.String |
getText()
Returns the text of the PSI element.
|
PsiType |
getType()
Returns the type of the variable.
|
PsiTypeElement |
getTypeElement()
Returns the type element declaring the type of the variable.
|
boolean |
hasInitializer()
Checks if the variable has an initializer.
|
boolean |
hasModifierProperty(java.lang.String name)
Checks if the element has the specified modifier.
|
boolean |
isValid()
Checks if this PSI element is valid.
|
protected boolean |
isVisibilitySupported() |
boolean |
isWritable()
Checks if the contents of the element can be modified (if it belongs to a
non-read-only source file.)
|
void |
normalizeDeclaration()
Ensures that the variable declaration is not combined in the same statement with
other declarations.
|
PsiElement |
setName(java.lang.String name)
Renames the element.
|
void |
setOriginInfo(java.lang.String originInfo) |
accept, add, addAfter, addBefore, checkAdd, checkDelete, copy, delete, findElementAt, getChildren, getContainingFile, getLanguage, getManager, getNavigationElement, getNextSibling, getNode, getParent, getPrevSibling, getStartOffsetInParent, getTextLength, getTextOffset, getTextRange, isPhysical, replace, setNavigationElement, textMatches, textMatches, textToCharArray, toStringacceptChildren, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, findReferenceAt, getContext, getFirstChild, getLastChild, getOriginalElement, getPresentation, getProject, getReference, getReferences, getResolveScope, getUseScope, isEquivalentTo, navigate, notNullChild, processDeclarations, textContainsbuildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, overlayIcons, registerIconLayer, transformFlagschangeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMapequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitsetInitializergetAnnotation, getAnnotations, hasAnnotation, hasModifiergetIdentifyingElementaccept, acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, getCopyableUserData, getFirstChild, getLanguage, getLastChild, getManager, getNavigationElement, getNextSibling, getNode, getOriginalElement, getOwnReferences, getParent, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getStartOffsetInParent, getTextLength, getTextOffset, getTextRange, getTextRangeInParent, getUseScope, isEquivalentTo, isPhysical, processDeclarations, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray, toStringgetUserData, putUserDatagetNavigationElementcanNavigate, canNavigateToSource, navigateprotected PsiElement myScope
protected PsiIdentifier myNameIdentifier
protected PsiType myType
protected final PsiModifierList myModifierList
protected boolean myWritable
public LightVariableBase(PsiManager manager, PsiIdentifier nameIdentifier, PsiType type, boolean writable, PsiElement scope)
public LightVariableBase(PsiManager manager, PsiIdentifier nameIdentifier, Language language, PsiType type, boolean writable, PsiElement scope)
protected PsiModifierList createModifierList()
public PsiElement getDeclarationScope()
public PsiIdentifier getNameIdentifier()
PsiVariablegetNameIdentifier in interface PsiNameIdentifierOwnergetNameIdentifier in interface PsiVariablepublic 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 PomTargetisValid in interface PsiElementisValid in class LightElementPsiUtilCore.ensureValid(PsiElement)public java.lang.String getName()
PsiNamedElementgetName in interface NavigationItemgetName in interface PomNamedTargetgetName in interface PsiNamedElementgetName in class PsiElementBasepublic 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 PsiType getType()
PsiVariablegetType in interface PsiVariableprotected PsiType computeType()
public PsiTypeElement getTypeElement()
PsiVariablegetTypeElement 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.String getText()
PsiElementgetText in interface PsiElementgetText in class LightElementPsiElement.textMatches(java.lang.CharSequence),
PsiElement.textContains(char)public java.lang.Object computeConstantValue()
PsiVariablecomputeConstantValue in interface PsiVariablepublic 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 boolean isWritable()
PsiElementisWritable in interface PomRenameableTarget<PsiElement>isWritable in interface PsiElementisWritable in class LightElementprotected boolean isVisibilitySupported()
isVisibilitySupported in class ElementBasepublic javax.swing.Icon getElementIcon(int flags)
getElementIcon in class ElementBasepublic java.lang.String getOriginInfo()
getOriginInfo in interface OriginInfoAwareElementpublic void setOriginInfo(java.lang.String originInfo)