public class PomTargetPsiElementImpl extends RenameableFakePsiElement implements PomTargetPsiElement
Iconable.IconFlags, Iconable.LastComputedIcon
FLAGS_LOCKED, ICON_PLACEHOLDER
ARRAY_FACTORY, EMPTY_ARRAY
ICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY
EMPTY_ARRAY
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
EMPTY_NAVIGATION_ITEM_ARRAY
Constructor and Description |
---|
PomTargetPsiElementImpl(Project project,
PomTarget target) |
PomTargetPsiElementImpl(PsiTarget target) |
Modifier and Type | Method and Description |
---|---|
boolean |
canNavigate()
Indicates whether this instance supports navigation of any kind.
|
boolean |
canNavigateToSource()
Indicates whether this instance supports navigation to source (that means some kind of editor).
|
boolean |
equals(java.lang.Object o) |
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.
|
javax.swing.Icon |
getIcon() |
Language |
getLanguage()
Returns the language of the PSI element.
|
java.lang.String |
getLocationString()
Returns the location of the object (for example, the package of a class).
|
java.lang.String |
getName()
Returns the name of the element.
|
PsiElement |
getNavigationElement()
Returns the PSI element which should be used as a navigation target
when navigation to this PSI element is requested.
|
PsiElement |
getParent()
Returns the parent of the PSI element.
|
Project |
getProject()
Returns the project to which the PSI element belongs.
|
PomTarget |
getTarget() |
java.lang.String |
getTypeName() |
int |
hashCode() |
boolean |
isEquivalentTo(PsiElement another)
This method shouldn't be called by clients directly, because there are no guarantees of it being symmetric.
|
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.)
|
void |
navigate(boolean requestFocus)
Open editor and select/navigate to the object there if possible.
|
PsiElement |
setName(java.lang.String name)
Renames the element.
|
getDeclaration, getIcon, getManager, getMetaData, getName, getTextRange, init
findElementAt, getChildren, getElementIcon, getFirstChild, getIcon, getLastChild, getNextSibling, getNode, getPresentableText, getPresentation, getPrevSibling, getStartOffsetInParent, getText, getTextLength, getTextOffset, isPhysical, textContains, textToCharArray
accept, acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, findReferenceAt, getOriginalElement, getReference, getReferences, getResolveScope, getUseScope, notNullChild, processDeclarations, replace, textMatches, textMatches
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
accept, acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getCopyableUserData, getFirstChild, getLastChild, getManager, getNextSibling, getNode, getOriginalElement, getOwnReferences, getPrevSibling, getReference, getReferences, getResolveScope, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, getTextRangeInParent, getUseScope, isPhysical, processDeclarations, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray, toString
getUserData, putUserData
getDependences, getDependencies
public PomTargetPsiElementImpl(PsiTarget target)
public PomTarget getTarget()
getTarget
in interface PomTargetPsiElement
public java.lang.String getName()
PsiNamedElement
getName
in interface NavigationItem
getName
in interface PsiMetaData
getName
in interface PsiNamedElement
getName
in class RenameableFakePsiElement
public boolean isWritable()
PsiElement
isWritable
in interface PsiElement
isWritable
in class PsiElementBase
public java.lang.String getTypeName()
getTypeName
in interface PsiPresentableMetaData
public PsiElement getNavigationElement()
PsiElement
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.)getNavigationElement
in interface PsiElement
getNavigationElement
in class PsiElementBase
public javax.swing.Icon getIcon()
getIcon
in interface PsiPresentableMetaData
public boolean isValid()
PsiElement
PsiDocumentManager.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 PsiElement
isValid
in class PsiElementBase
PsiUtilCore.ensureValid(PsiElement)
public PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElement
setName
in interface PsiNamedElement
setName
in class FakePsiElement
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 boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isEquivalentTo(PsiElement another)
PsiElement
PsiManager.areElementsEquivalent(PsiElement, PsiElement)
internally, which clients should invoke instead.
Implementations of this method should return true
if the parameter is resolve-equivalent to this
, i.e. it represents
the same entity from the language perspective. See also PsiManager.areElementsEquivalent(PsiElement, PsiElement)
documentation.isEquivalentTo
in interface PsiElement
isEquivalentTo
in class PsiElementBase
public PsiElement getContext()
PsiElement
getParent()
,
but the context can be overridden for some elements like code fragments (see
JavaCodeFragmentFactory.createCodeBlockCodeFragment(String, PsiElement, boolean)
).getContext
in interface PsiElement
getContext
in class PsiElementBase
public PsiElement getParent()
PsiElement
getParent
in interface PsiElement
getParent
in class RenameableFakePsiElement
public void navigate(boolean requestFocus)
Navigatable
navigate
in interface Navigatable
navigate
in class PsiElementBase
requestFocus
- true
if focus requesting is necessarypublic boolean canNavigate()
Navigatable
Navigatable.canNavigateToSource()
returns true
.
We assume that this method should return true
in such case,
so implement this method respectively.canNavigate
in interface Navigatable
canNavigate
in class PsiElementBase
false
if navigation is not possible for any reason.public boolean canNavigateToSource()
Navigatable
false
.
In such cases it is not recommended to do batch navigation for all navigatables
available via CommonDataKeys.NAVIGATABLE_ARRAY
,
because it may lead to opening several modal dialogs.
Use OpenSourceUtil.navigate(com.intellij.pom.Navigatable...)
to process such arrays correctly.canNavigateToSource
in interface Navigatable
canNavigateToSource
in class PsiElementBase
false
if navigation to source is not possible for any reason.public PsiFile getContainingFile()
PsiElement
getContainingFile
in interface PsiElement
getContainingFile
in class RenameableFakePsiElement
public Language getLanguage()
PsiElement
getLanguage
in interface PsiElement
getLanguage
in class RenameableFakePsiElement
public Project getProject()
PsiElement
getProject
in interface PsiElement
getProject
in class RenameableFakePsiElement
public java.lang.String getLocationString()
ItemPresentation
getLocationString
in interface ItemPresentation
getLocationString
in class FakePsiElement