public class EmptyXmlTag extends java.lang.Object implements XmlTag
Iconable.IconFlags, Iconable.LastComputedIcon| Modifier and Type | Field and Description |
|---|---|
static XmlTag |
INSTANCE |
EMPTY_ARRAYEMPTY_ARRAYDEPENDING_ELEMENT, DO_NOT_VALIDATE, INCLUDING_ELEMENTARRAY_FACTORYICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY| Constructor and Description |
|---|
EmptyXmlTag() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
XmlTag |
addSubTag(XmlTag subTag,
boolean first) |
void |
checkAdd(PsiElement element)
Checks if it is possible to add the specified element as a child to this element,
and throws an exception if the add is not possible.
|
void |
checkDelete()
Checks if it is possible to delete the specified element from the tree,
and throws an exception if the add is not possible.
|
void |
collapseIfEmpty() |
PsiElement |
copy()
Creates a copy of the file containing the PSI element and returns the corresponding
element in the created copy.
|
XmlTag |
createChildTag(java.lang.String localName,
java.lang.String namespace,
java.lang.String bodyText,
boolean enforceNamespacesDeep)
Creates a new child tag
|
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.
|
XmlTag |
findFirstSubTag(java.lang.String qname) |
PsiReference |
findReferenceAt(int offset)
Finds a reference at the specified offset from the start of the text range of this node.
|
XmlTag [] |
findSubTags(java.lang.String qname) |
XmlTag [] |
findSubTags(java.lang.String localName,
java.lang.String namespace) |
XmlAttribute |
getAttribute(java.lang.String qname)
Returns a tag attribute by qualified name.
|
XmlAttribute |
getAttribute(java.lang.String name,
java.lang.String namespace) |
XmlAttribute [] |
getAttributes() |
java.lang.String |
getAttributeValue(java.lang.String qname)
Returns a tag attribute value by qualified name.
|
java.lang.String |
getAttributeValue(java.lang.String name,
java.lang.String namespace) |
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.
|
<T> T |
getCopyableUserData(Key<T> key)
Returns a copyable user data object attached to this element.
|
XmlElementDescriptor |
getDescriptor() |
PsiElement |
getFirstChild()
Returns the first child of the PSI element.
|
javax.swing.Icon |
getIcon(int flags) |
Language |
getLanguage()
Returns the language of the PSI element.
|
PsiElement |
getLastChild()
Returns the last child of the PSI element.
|
java.lang.String |
getLocalName() |
java.util.Map<java.lang.String,java.lang.String> |
getLocalNamespaceDeclarations() |
PsiManager |
getManager()
Returns the PSI manager for the project to which the PSI element belongs.
|
PsiMetaData |
getMetaData() |
java.lang.String |
getName()
Returns the name of the element.
|
java.lang.String |
getNamespace() |
java.lang.String |
getNamespaceByPrefix(java.lang.String prefix) |
java.lang.String |
getNamespacePrefix() |
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.
|
XmlTagChild |
getNextSiblingInTag() |
ASTNode |
getNode()
Returns the AST node corresponding to the element.
|
XmlNSDescriptor |
getNSDescriptor(java.lang.String namespace,
boolean strict) |
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.
|
XmlTag |
getParentTag() |
java.lang.String |
getPrefixByNamespace(java.lang.String namespace) |
PsiElement |
getPrevSibling()
Returns the previous sibling of the PSI element.
|
XmlTagChild |
getPrevSiblingInTag() |
Project |
getProject()
Returns the project to which the PSI element belongs.
|
PsiReference |
getReference()
Returns the reference from this PSI element to another PSI element (or elements), if one exists.
|
PsiReference [] |
getReferences()
Returns all references from this PSI element to other PSI elements.
|
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.
|
XmlTag [] |
getSubTags() |
java.lang.String |
getSubTagText(java.lang.String qname) |
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.
|
<T> T |
getUserData(Key<T> key) |
SearchScope |
getUseScope()
Returns the scope in which references to this element are searched.
|
XmlTagValue |
getValue() |
boolean |
hasNamespaceDeclarations() |
boolean |
isEmpty() |
boolean |
isEquivalentTo(PsiElement another)
This method shouldn't be called by clients directly, because there are no guarantees of it being symmetric.
|
boolean |
isPhysical()
Checks if an actual source or class file corresponds to the element.
|
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.)
|
java.lang.String[] |
knownNamespaces() |
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.
|
boolean |
processElements(PsiElementProcessor processor,
PsiElement place) |
<T> void |
putCopyableUserData(Key<T> key,
T value)
Attaches a copyable user data object to this element.
|
<T> void |
putUserData(Key<T> key,
T value)
Add a new user data value to this object.
|
PsiElement |
replace(PsiElement newElement)
Replaces this PSI element (along with all its children) with another element
(along with the children).
|
XmlAttribute |
setAttribute(java.lang.String qname,
java.lang.String value) |
XmlAttribute |
setAttribute(java.lang.String name,
java.lang.String namespace,
java.lang.String value) |
PsiElement |
setName(java.lang.String name)
Renames the element.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHostName, getRealNs, isCaseSensitiveskipValidationgetOwnReferences, getTextRangeInParent, toStringpublic static XmlTag INSTANCE
public java.lang.String getName()
PsiNamedElementgetName in interface PsiNamedElementgetName in interface XmlTagpublic PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElementsetName in interface PsiNamedElementname - 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 java.lang.String getNamespace()
getNamespace in interface XmlTagpublic java.lang.String getLocalName()
getLocalName in interface XmlTagpublic XmlElementDescriptor getDescriptor()
getDescriptor in interface XmlTagpublic XmlAttribute [] getAttributes()
getAttributes in interface XmlTagpublic XmlAttribute getAttribute(java.lang.String name, java.lang.String namespace)
getAttribute in interface XmlTagpublic XmlAttribute getAttribute(java.lang.String qname)
XmlTaggetAttribute in interface XmlTagqname - qualified attribute name, like "ns:name" or "name".XmlTag.getAttribute(String, String)public java.lang.String getAttributeValue(java.lang.String name,
java.lang.String namespace)
getAttributeValue in interface XmlTagpublic java.lang.String getAttributeValue(java.lang.String qname)
XmlTaggetAttributeValue in interface XmlTagqname - qualified attribute name, like "ns:name" or "name".XmlTag.getAttributeValue(String, String)public XmlAttribute setAttribute(java.lang.String name, java.lang.String namespace, java.lang.String value) throws IncorrectOperationException
setAttribute in interface XmlTagIncorrectOperationExceptionpublic XmlAttribute setAttribute(java.lang.String qname, java.lang.String value) throws IncorrectOperationException
setAttribute in interface XmlTagIncorrectOperationExceptionpublic XmlTag createChildTag(java.lang.String localName, java.lang.String namespace, java.lang.String bodyText, boolean enforceNamespacesDeep)
XmlTagcreateChildTag in interface XmlTaglocalName - new tag's namenamespace - new tag's namespacebodyText - pass null to create collapsed tag, empty string means creating expanded oneenforceNamespacesDeep - if you pass some xml tags to bodyText parameter, this flag sets namespace prefixes for themXmlTag.addSubTag(XmlTag, boolean)} to add it to parentpublic XmlTag [] getSubTags()
getSubTags in interface XmlTagpublic XmlTag [] findSubTags(java.lang.String qname)
findSubTags in interface XmlTagpublic XmlTag [] findSubTags(java.lang.String localName, java.lang.String namespace)
findSubTags in interface XmlTaglocalName - non-qualified tag name.namespace - if null, name treated as qualified name to find.public XmlTag findFirstSubTag(java.lang.String qname)
findFirstSubTag in interface XmlTagpublic java.lang.String getNamespacePrefix()
getNamespacePrefix in interface XmlTagpublic java.lang.String getNamespaceByPrefix(java.lang.String prefix)
getNamespaceByPrefix in interface XmlTagpublic java.lang.String getPrefixByNamespace(java.lang.String namespace)
getPrefixByNamespace in interface XmlTagpublic java.lang.String[] knownNamespaces()
knownNamespaces in interface XmlTagpublic boolean hasNamespaceDeclarations()
hasNamespaceDeclarations in interface XmlTagpublic java.util.Map<java.lang.String,java.lang.String> getLocalNamespaceDeclarations()
getLocalNamespaceDeclarations in interface XmlTagpublic XmlTagValue getValue()
public XmlNSDescriptor getNSDescriptor(java.lang.String namespace, boolean strict)
getNSDescriptor in interface XmlTagpublic void collapseIfEmpty()
collapseIfEmpty in interface XmlTagpublic java.lang.String getSubTagText(java.lang.String qname)
getSubTagText in interface XmlTagpublic XmlTag getParentTag()
getParentTag in interface XmlTagChildpublic XmlTagChild getNextSiblingInTag()
getNextSiblingInTag in interface XmlTagChildpublic XmlTagChild getPrevSiblingInTag()
getPrevSiblingInTag in interface XmlTagChildpublic boolean processElements(PsiElementProcessor processor, PsiElement place)
processElements in interface XmlElementpublic Project getProject() throws PsiInvalidElementAccessException
PsiElementgetProject in interface PsiElementPsiInvalidElementAccessException - if this element is invalidpublic Language getLanguage()
PsiElementgetLanguage in interface PsiElementpublic PsiManager getManager()
PsiElementgetManager in interface PsiElementpublic PsiElement [] getChildren()
PsiElementgetChildren in interface PsiElementpublic PsiElement getParent()
PsiElementgetParent in interface PsiElementpublic PsiElement getFirstChild()
PsiElementgetFirstChild in interface PsiElementpublic PsiElement getLastChild()
PsiElementgetLastChild in interface PsiElementpublic PsiElement getNextSibling()
PsiElementgetNextSibling in interface PsiElementpublic PsiElement getPrevSibling()
PsiElementgetPrevSibling in interface PsiElementpublic PsiFile getContainingFile() throws PsiInvalidElementAccessException
PsiElementgetContainingFile in interface PsiElementPsiInvalidElementAccessException - if this element is invalidpublic TextRange getTextRange()
PsiElementgetTextRange in interface PsiElementpublic int getStartOffsetInParent()
PsiElementgetStartOffsetInParent in interface PsiElementpublic int getTextLength()
PsiElementgetTextLength in interface PsiElementpublic PsiElement findElementAt(int offset)
PsiElementfindElementAt in interface PsiElementoffset - the relative offset for which the PSI element is requested.public PsiReference findReferenceAt(int offset)
PsiElementfindReferenceAt in interface PsiElementoffset - the relative offset for which the reference is requested.public int getTextOffset()
PsiElementPsiNamedElement, this should return the offset in the file of the
name identifier.)getTextOffset in interface PsiElementpublic java.lang.String getText()
PsiElementgetText in interface PsiElementPsiElement.textMatches(java.lang.CharSequence),
PsiElement.textContains(char)public char [] textToCharArray()
PsiElementtextToCharArray in interface PsiElementpublic PsiElement getNavigationElement()
PsiElementthis 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 PsiElementpublic PsiElement getOriginalElement()
PsiElementthis 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.)getOriginalElement in interface PsiElementpublic boolean textMatches(java.lang.CharSequence text)
PsiElementtextMatches in interface PsiElementtext - the character sequence to compare with.public boolean textMatches(PsiElement element)
PsiElementtextMatches in interface PsiElementelement - the element to compare the text with.public boolean textContains(char c)
PsiElementtextContains in interface PsiElementc - the character to search for.public void accept(PsiElementVisitor visitor)
PsiElementaccept in interface PsiElementvisitor - the visitor to pass the element to.public void acceptChildren(PsiElementVisitor visitor)
PsiElementacceptChildren in interface PsiElementvisitor - the visitor to pass the children to.public PsiElement copy()
PsiElementcopy in interface PsiElementpublic PsiElement add(PsiElement element) throws IncorrectOperationException
PsiElementadd in interface PsiElementelement - the child element to add.element or its copy).IncorrectOperationException - if the modification is not supported or not possible for some reason.public PsiElement addBefore(PsiElement element, PsiElement anchor) throws IncorrectOperationException
PsiElementaddBefore in interface PsiElementelement - 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.public PsiElement addAfter(PsiElement element, PsiElement anchor) throws IncorrectOperationException
PsiElementaddAfter in interface PsiElementelement - 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.public void checkAdd(PsiElement element) throws IncorrectOperationException
PsiElementcheckAdd in interface PsiElementelement - the child element to check the add possibility.IncorrectOperationException - if the modification is not supported or not possible for some reason.public PsiElement addRange(PsiElement first, PsiElement last) throws IncorrectOperationException
PsiElementaddRange in interface PsiElementfirst - 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.public PsiElement addRangeBefore(PsiElement first, PsiElement last, PsiElement anchor) throws IncorrectOperationException
PsiElementaddRangeBefore in interface PsiElementfirst - 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.public PsiElement addRangeAfter(PsiElement first, PsiElement last, PsiElement anchor) throws IncorrectOperationException
PsiElementaddRangeAfter in interface PsiElementfirst - 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.public void delete()
throws IncorrectOperationException
PsiElementdelete in interface PsiElementIncorrectOperationException - if the modification is not supported
or not possible for some reason (for example, the file containing the element is read-only).public void checkDelete()
throws IncorrectOperationException
PsiElementcheckDelete in interface PsiElementIncorrectOperationException - if the modification is not supported or not possible for some reason.public void deleteChildRange(PsiElement first, PsiElement last) throws IncorrectOperationException
PsiElementdeleteChildRange in interface PsiElementfirst - 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.public PsiElement replace(PsiElement newElement) throws IncorrectOperationException
PsiElementreplace in interface PsiElementnewElement - the element to replace this element with.newElement or its copy)IncorrectOperationException - if the modification is not supported or not possible for some reason.public 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 PsiElementPsiUtilCore.ensureValid(PsiElement)public boolean isWritable()
PsiElementisWritable in interface PsiElementpublic PsiReference getReference()
PsiElementPsiElement.getReferences()
for an example), returns the first associated reference.getReference in interface PsiElementReferencesSearchpublic PsiReference [] getReferences()
PsiElementPsiPolyVariantReference should be used instead
of returning multiple references.
Actually, it's preferable to call PsiReferenceService.getReferences(com.intellij.psi.PsiElement, com.intellij.psi.PsiReferenceService.Hints) instead
as it allows adding references by plugins when the element implements ContributedReferenceHost.getReferences in interface PsiElementPsiReferenceService.getReferences(com.intellij.psi.PsiElement, com.intellij.psi.PsiReferenceService.Hints),
ReferencesSearchpublic <T> T getCopyableUserData(Key<T> key)
PsiElementgetCopyableUserData in interface PsiElementkey - the key for accessing the user data object.PsiElement.putCopyableUserData(Key, Object)public <T> void putCopyableUserData(Key<T> key, T value)
PsiElementputCopyableUserData in interface PsiElementkey - the key for accessing the user data object.value - the user data object to attach.PsiElement.getCopyableUserData(Key)public boolean processDeclarations(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place)
PsiElementprocessDeclarations in interface PsiElementprocessor - 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 PsiElement getContext()
PsiElementgetParent(),
but the context can be overridden for some elements like code fragments (see
JavaCodeFragmentFactory.createCodeBlockCodeFragment(String, PsiElement, boolean)).getContext in interface PsiElementpublic boolean isPhysical()
PsiElementPsiDocumentManager.getDocument(PsiFile) returns null for non-physical elements.
Not to be confused with FileViewProvider.isPhysical().isPhysical in interface PsiElementpublic GlobalSearchScope getResolveScope()
PsiElementgetResolveScope in interface PsiElementpublic SearchScope getUseScope()
PsiElementgetUseScope in interface PsiElementPsiSearchHelper.getUseScope(PsiElement)public ASTNode getNode()
PsiElementgetNode in interface PsiElementpublic boolean isEquivalentTo(PsiElement another)
PsiElementPsiManager.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 PsiElementpublic PsiMetaData getMetaData()
getMetaData in interface PsiMetaOwnerpublic <T> T getUserData(Key<T> key)
getUserData in interface UserDataHolderpublic <T> void putUserData(Key<T> key, T value)
UserDataHolderputUserData in interface UserDataHolder