コード例 #1
0
  @NotNull
  public XmlFile getContainingFile(@NotNull DomElement domElement) {
    if (domElement instanceof DomFileElement) {
      return ((DomFileElement) domElement).getFile();
    }
    DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(domElement);
    assert handler != null : domElement;
    while (handler != null
        && !(handler instanceof DomRootInvocationHandler)
        && handler.getXmlTag() == null) {
      handler = handler.getParentHandler();
    }
    if (handler instanceof DomRootInvocationHandler) {
      return ((DomRootInvocationHandler) handler).getParent().getFile();
    }
    assert handler != null;
    XmlTag tag = handler.getXmlTag();
    assert tag != null;
    while (true) {
      final PsiElement parentTag = PhysicalDomParentStrategy.getParentTagCandidate(tag);
      if (!(parentTag instanceof XmlTag)) {
        return (XmlFile) tag.getContainingFile();
      }

      tag = (XmlTag) parentTag;
    }
  }
コード例 #2
0
 @Override
 @NotNull
 public XmlFile getContainingFile(@NotNull DomElement domElement) {
   if (domElement instanceof DomFileElement) {
     return ((DomFileElement) domElement).getFile();
   }
   return DomManagerImpl.getNotNullHandler(domElement).getFile();
 }
コード例 #3
0
 @NotNull
 public EvaluatedXmlName getEvaluatedXmlName(@NotNull final DomElement element) {
   return DomManagerImpl.getDomInvocationHandler(element).getXmlName();
 }
コード例 #4
0
 @Override
 @NotNull
 public EvaluatedXmlName getEvaluatedXmlName(@NotNull final DomElement element) {
   return DomManagerImpl.getNotNullHandler(element).getXmlName();
 }