Java 类com.intellij.psi.impl.source.xml.SchemaPrefix 实例源码

项目:intellij-ce-playground    文件:DefaultXmlExtension.java   
@Override
public SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix) {
  @NonNls String nsDeclarationAttrName = null;
  for(XmlTag t = context; t != null; t = t.getParentTag()) {
    if (t.hasNamespaceDeclarations()) {
      if (nsDeclarationAttrName == null) nsDeclarationAttrName = namespacePrefix.length() > 0 ? "xmlns:"+namespacePrefix:"xmlns";
      XmlAttribute attribute = t.getAttribute(nsDeclarationAttrName);
      if (attribute != null) {
        final String attrPrefix = attribute.getNamespacePrefix();
        final TextRange textRange = TextRange.from(attrPrefix.length() + 1, namespacePrefix.length());
        return new SchemaPrefix(attribute, textRange, namespacePrefix);
      }
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:SchemaPrefixRenameHandler.java   
@Override
protected VariableInplaceRenamer createRenamer(@NotNull PsiElement elementToRename, Editor editor) {
  PossiblePrefixReference reference = getReference(elementToRename.getContainingFile(), editor);
  if (reference != null) {
    PsiElement prefix = reference.resolve();
    if (prefix instanceof SchemaPrefix) {
      return new VariableInplaceRenamer((PsiNamedElement)prefix, editor) {
        @Override
        protected void addReferenceAtCaret(Collection<PsiReference> refs) {}

        @Override
        protected boolean isReferenceAtCaret(PsiElement selectedElement, PsiReference ref) {
          return false;
        }
      };
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:AndroidXmlExtension.java   
@Override
public SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix) {
  SchemaPrefix prefix = super.getPrefixDeclaration(context, namespacePrefix);
  if (prefix != null) {
    return prefix;
  }

  if (namespacePrefix.isEmpty()) {
    // In for example XHTML documents, the root element looks like this:
    //  <html xmlns="http://www.w3.org/1999/xhtml">
    // This means that the IDE can find the namespace for "".
    //
    // However, in Android XML files it's implicit, so just return a dummy SchemaPrefix so
    // // that we don't end up with a
    //      Namespace ''{0}'' is not bound
    // error from {@link XmlUnboundNsPrefixInspection#checkUnboundNamespacePrefix}
    return new SchemaPrefix(null, new TextRange(0, 0), SdkConstants.ANDROID_NS_NAME);
  }

  return null;
}
项目:intellij-ce-playground    文件:XsltNamespaceContext.java   
@Nullable
public static PsiElement resolvePrefix(final String prefix, XmlElement context) {
    final String name = "xmlns:" + prefix;

    XmlTag parent = PsiTreeUtil.getParentOfType(context, XmlTag.class);
    while (parent != null) {
        final XmlAttribute attribute = parent.getAttribute(name, null);
        if (attribute != null) {
          final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length());
          return new SchemaPrefix(attribute, textRange, prefix) {
            @Override
            public boolean equals(Object obj) {
              if (obj instanceof SchemaPrefix) {
                final SchemaPrefix p = (SchemaPrefix)obj;
                return prefix.equals(p.getName()) && p.getParent() == attribute;
              }
              return super.equals(obj);
            }
          };
        }
        parent = PsiTreeUtil.getParentOfType(parent, XmlTag.class);
    }
    return null;
}
项目:tools-idea    文件:SchemaPrefixRenameHandler.java   
@Override
protected VariableInplaceRenamer createRenamer(@NotNull PsiElement elementToRename, Editor editor) {
  PossiblePrefixReference reference = getReference(elementToRename.getContainingFile(), editor);
  if (reference != null) {
    PsiElement prefix = reference.resolve();
    if (prefix instanceof SchemaPrefix) {
      return new VariableInplaceRenamer((PsiNamedElement)prefix, editor) {
        @Override
        protected void addReferenceAtCaret(Collection<PsiReference> refs) {}

        @Override
        protected boolean isReferenceAtCaret(PsiElement selectedElement, PsiReference ref) {
          return false;
        }
      };
    }
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    System.out.println("Reference: " + reference);
    if (reference != null) {
      System.out.println("Resolved: " + reference.resolve());
    }
  }
  return null;
}
项目:tools-idea    文件:XsltNamespaceContext.java   
@Nullable
public static PsiElement resolvePrefix(final String prefix, XmlElement context) {
    final String name = "xmlns:" + prefix;

    XmlTag parent = PsiTreeUtil.getParentOfType(context, XmlTag.class);
    while (parent != null) {
        final XmlAttribute attribute = parent.getAttribute(name, null);
        if (attribute != null) {
          final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length());
          return new SchemaPrefix(attribute, textRange, prefix) {
            @Override
            public boolean equals(Object obj) {
              if (obj instanceof SchemaPrefix) {
                final SchemaPrefix p = (SchemaPrefix)obj;
                return prefix.equals(p.getName()) && p.getParent() == attribute;
              }
              return super.equals(obj);
            }
          };
        }
        parent = PsiTreeUtil.getParentOfType(parent, XmlTag.class);
    }
    return null;
}
项目:consulo-xslt    文件:XsltNamespaceContext.java   
@Nullable
public static PsiElement resolvePrefix(final String prefix, XmlElement context) {
    final String name = "xmlns:" + prefix;

    XmlTag parent = PsiTreeUtil.getParentOfType(context, XmlTag.class);
    while (parent != null) {
        final XmlAttribute attribute = parent.getAttribute(name, null);
        if (attribute != null) {
          final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length());
          return new SchemaPrefix(attribute, textRange, prefix) {
            @Override
            public boolean equals(Object obj) {
              if (obj instanceof SchemaPrefix) {
                final SchemaPrefix p = (SchemaPrefix)obj;
                return prefix.equals(p.getName()) && p.getParent() == attribute;
              }
              return super.equals(obj);
            }
          };
        }
        parent = PsiTreeUtil.getParentOfType(parent, XmlTag.class);
    }
    return null;
}
项目:consulo-xml    文件:DefaultXmlExtension.java   
@Override
public SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix)
{
    @NonNls String nsDeclarationAttrName = null;
    for(XmlTag t = context; t != null; t = t.getParentTag())
    {
        if(t.hasNamespaceDeclarations())
        {
            if(nsDeclarationAttrName == null)
            {
                nsDeclarationAttrName = namespacePrefix.length() > 0 ? "xmlns:" + namespacePrefix : "xmlns";
            }
            XmlAttribute attribute = t.getAttribute(nsDeclarationAttrName);
            if(attribute != null)
            {
                final String attrPrefix = attribute.getNamespacePrefix();
                final TextRange textRange = TextRange.from(attrPrefix.length() + 1, namespacePrefix.length());
                return new SchemaPrefix(attribute, textRange, namespacePrefix);
            }
        }
    }
    return null;
}
项目:consulo-xml    文件:SchemaPrefixRenameHandler.java   
@Override
protected VariableInplaceRenamer createRenamer(@NotNull PsiElement elementToRename, Editor editor) {
  PossiblePrefixReference reference = getReference(elementToRename.getContainingFile(), editor);
  if (reference != null) {
    PsiElement prefix = reference.resolve();
    if (prefix instanceof SchemaPrefix) {
      return new VariableInplaceRenamer((PsiNamedElement)prefix, editor) {
        @Override
        protected void addReferenceAtCaret(Collection<PsiReference> refs) {}

        @Override
        protected boolean isReferenceAtCaret(PsiElement selectedElement, PsiReference ref) {
          return false;
        }
      };
    }
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    System.out.println("Reference: " + reference);
    if (reference != null) {
      System.out.println("Resolved: " + reference.resolve());
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:XmlRefCountHolder.java   
private void visitOuterLanguageElement(@NotNull final PsiElement element) {
  myHolder.registerOuterLanguageElement(element);
  PsiReference[] references = element.getReferences();
  for (PsiReference reference : references) {
    if (reference instanceof PossiblePrefixReference && ((PossiblePrefixReference)reference).isPrefixReference()) {
      PsiElement resolve = reference.resolve();
      if (resolve instanceof SchemaPrefix) {
        myHolder.addUsedPrefix(((SchemaPrefix)resolve).getName());
      }
    }
  }
}
项目:intellij-ce-playground    文件:XmlDocumentationProvider.java   
@Override
@Nullable
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
  if (element instanceof SchemaPrefix) {
    return ((SchemaPrefix)element).getQuickNavigateInfo();
  }
  return null;
}
项目:intellij-ce-playground    文件:HtmlDocumentationProvider.java   
@Override
@Nullable
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
  if (element instanceof SchemaPrefix) {
    return ((SchemaPrefix)element).getQuickNavigateInfo();
  }
  return null;
}
项目:intellij-ce-playground    文件:PrefixReferenceProvider.java   
@Override
@Nullable
public PsiElement resolve() {
  final String prefix = getCanonicalText();
  XmlTag tag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class);
  while (tag != null) {
    if (tag.getLocalNamespaceDeclarations().containsKey(prefix)) {
      final XmlAttribute attribute = tag.getAttribute("xmlns:" + prefix, "");
      final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length());
      return new SchemaPrefix(attribute, textRange, prefix);
    }
    tag = tag.getParentTag();
  }
  return null;
}
项目:intellij-ce-playground    文件:PrefixReferenceProvider.java   
@Override
public boolean isReferenceTo(PsiElement element) {
  if (element instanceof SchemaPrefix && element.getContainingFile() == myElement.getContainingFile()) {
    final PsiElement e = resolve();
    if (e instanceof SchemaPrefix) {
      final String s = ((SchemaPrefix)e).getName();
      return s != null && s.equals(((SchemaPrefix)element).getName());
    }
  }
  return super.isReferenceTo(element);
}
项目:intellij-ce-playground    文件:XsltImplicitUsagesProvider.java   
public boolean isImplicitUsage(PsiElement element) {
    if (!(element instanceof XmlAttribute)) {
        return false;
    }
    final XmlAttribute attr = (XmlAttribute)element;
    if (!attr.isNamespaceDeclaration()) {
        return false;
    }
    final PsiFile file = attr.getContainingFile();
    if (!(file instanceof XmlFile)) {
      return false;
    }

    // also catch namespace declarations in "normal" XML files that have XPath injected into some attributes
    // ContextProvider.hasXPathInjections() is an optimization that avoids to run the references search on totally XPath-free XML files
    if (!ContextProvider.hasXPathInjections((XmlFile)file) && !XsltSupport.isXsltFile(file)) {
        return false;
    }

    // This need to catch both prefix references from injected XPathFiles and prefixes from mode declarations/references:
    // <xsl:template match="*" mode="prefix:name" />

    // BTW: Almost the same logic applies to other XML dialects (RELAX-NG).
    // Pull this class into the platform?
    final String prefix = attr.getLocalName();
    final SchemaPrefix target = new SchemaPrefix(attr, TextRange.from("xmlns:".length(), prefix.length()), prefix);
    final Query<PsiReference> q = ReferencesSearch.search(target, new LocalSearchScope(attr.getParent()));
    return !q.forEach(new Processor<PsiReference>() {
        public boolean process(PsiReference psiReference) {
            if (psiReference.getElement() == attr) {
                return true;
            }
            return false;
        }
    });
}
项目:react-templates-plugin    文件:RTHtmlExtension.java   
@Override
    public SchemaPrefix getPrefixDeclaration(XmlTag context, String namespacePrefix) {
//        if ("rt".equals(namespacePrefix)) {
//            return new SchemaPrefix(null, null, namespacePrefix);
//        }
        return super.getPrefixDeclaration(context, namespacePrefix);
    }
项目:react-templates-plugin    文件:RTHtmlExtension.java   
@Override
    public SchemaPrefix getPrefixDeclaration(XmlTag context, String namespacePrefix) {
//        if ("rt".equals(namespacePrefix)) {
//            return new SchemaPrefix(null, null, namespacePrefix);
//        }
        return super.getPrefixDeclaration(context, namespacePrefix);
    }
项目:tools-idea    文件:DefaultXmlExtension.java   
public SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix) {
  @NonNls String nsDeclarationAttrName = null;
  for(XmlTag t = context; t != null; t = t.getParentTag()) {
    if (t.hasNamespaceDeclarations()) {
      if (nsDeclarationAttrName == null) nsDeclarationAttrName = namespacePrefix.length() > 0 ? "xmlns:"+namespacePrefix:"xmlns";
      XmlAttribute attribute = t.getAttribute(nsDeclarationAttrName);
      if (attribute != null) {
        final String attrPrefix = attribute.getNamespacePrefix();
        final TextRange textRange = TextRange.from(attrPrefix.length() + 1, namespacePrefix.length());
        return new SchemaPrefix(attribute, textRange, namespacePrefix);
      }
    }
  }
  return null;
}
项目:tools-idea    文件:XmlDocumentationProvider.java   
@Nullable
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
  if (element instanceof SchemaPrefix) {
    return ((SchemaPrefix)element).getQuickNavigateInfo();
  }
  return null;
}
项目:tools-idea    文件:HtmlDocumentationProvider.java   
@Nullable
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
  if (element instanceof SchemaPrefix) {
    return ((SchemaPrefix)element).getQuickNavigateInfo();
  }
  return null;
}
项目:tools-idea    文件:XmlRefCountHolder.java   
private void visitOuterLanguageElement(@NotNull final PsiElement element) {
  myHolder.registerOuterLanguageElement(element);
  PsiReference[] references = element.getReferences();
  for (PsiReference reference : references) {
    if (reference instanceof PossiblePrefixReference && ((PossiblePrefixReference)reference).isPrefixReference()) {
      PsiElement resolve = reference.resolve();
      if (resolve instanceof SchemaPrefix) {
        myHolder.addUsedPrefix(((SchemaPrefix)resolve).getName());
      }
    }
  }
}
项目:tools-idea    文件:PrefixReferenceProvider.java   
@Nullable
public PsiElement resolve() {
  final String prefix = getCanonicalText();
  XmlTag tag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class);
  while (tag != null) {
    if (tag.getLocalNamespaceDeclarations().containsKey(prefix)) {
      final XmlAttribute attribute = tag.getAttribute("xmlns:" + prefix, "");
      final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length());
      return new SchemaPrefix(attribute, textRange, prefix);
    }
    tag = tag.getParentTag();
  }
  return null;
}
项目:tools-idea    文件:PrefixReferenceProvider.java   
@Override
public boolean isReferenceTo(PsiElement element) {
  if (element instanceof SchemaPrefix && element.getContainingFile() == myElement.getContainingFile()) {
    final PsiElement e = resolve();
    if (e instanceof SchemaPrefix) {
      final String s = ((SchemaPrefix)e).getName();
      return s != null && s.equals(((SchemaPrefix)element).getName());
    }
  }
  return super.isReferenceTo(element);
}
项目:tools-idea    文件:XsltImplicitUsagesProvider.java   
public boolean isImplicitUsage(PsiElement element) {
    if (!(element instanceof XmlAttribute)) {
        return false;
    }
    final XmlAttribute attr = (XmlAttribute)element;
    if (!attr.isNamespaceDeclaration()) {
        return false;
    }
    final PsiFile file = attr.getContainingFile();
    if (!(file instanceof XmlFile)) {
      return false;
    }

    // also catch namespace declarations in "normal" XML files that have XPath injected into some attributes
    // ContextProvider.hasXPathInjections() is an optimization that avoids to run the references search on totally XPath-free XML files
    if (!ContextProvider.hasXPathInjections((XmlFile)file) && !XsltSupport.isXsltFile(file)) {
        return false;
    }

    // This need to catch both prefix references from injected XPathFiles and prefixes from mode declarations/references:
    // <xsl:template match="*" mode="prefix:name" />

    // BTW: Almost the same logic applies to other XML dialects (RELAX-NG).
    // Pull this class into the platform?
    final String prefix = attr.getLocalName();
    final SchemaPrefix target = new SchemaPrefix(attr, TextRange.from("xmlns:".length(), prefix.length()), prefix);
    final Query<PsiReference> q = ReferencesSearch.search(target, new LocalSearchScope(attr.getParent()));
    return !q.forEach(new Processor<PsiReference>() {
        public boolean process(PsiReference psiReference) {
            if (psiReference.getElement() == attr) {
                return true;
            }
            return false;
        }
    });
}
项目:consulo-xslt    文件:XsltImplicitUsagesProvider.java   
public boolean isImplicitUsage(PsiElement element) {
    if (!(element instanceof XmlAttribute)) {
        return false;
    }
    final XmlAttribute attr = (XmlAttribute)element;
    if (!attr.isNamespaceDeclaration()) {
        return false;
    }
    final PsiFile file = attr.getContainingFile();
    if (!(file instanceof XmlFile)) {
      return false;
    }

    // also catch namespace declarations in "normal" XML files that have XPath injected into some attributes
    // ContextProvider.hasXPathInjections() is an optimization that avoids to run the references search on totally XPath-free XML files
    if (!ContextProvider.hasXPathInjections((XmlFile)file) && !XsltSupport.isXsltFile(file)) {
        return false;
    }

    // This need to catch both prefix references from injected XPathFiles and prefixes from mode declarations/references:
    // <xsl:template match="*" mode="prefix:name" />

    // BTW: Almost the same logic applies to other XML dialects (RELAX-NG).
    // Pull this class into the platform?
    final String prefix = attr.getLocalName();
    final SchemaPrefix target = new SchemaPrefix(attr, TextRange.from("xmlns:".length(), prefix.length()), prefix);
    final Query<PsiReference> q = ReferencesSearch.search(target, new LocalSearchScope(attr.getParent()));
    return !q.forEach(new Processor<PsiReference>() {
        public boolean process(PsiReference psiReference) {
            if (psiReference.getElement() == attr) {
                return true;
            }
            return false;
        }
    });
}
项目:consulo-xml    文件:PrefixReferenceProvider.java   
@Override
@Nullable
public PsiElement resolve() {
  final String prefix = getCanonicalText();
  XmlTag tag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class);
  while (tag != null) {
    if (tag.getLocalNamespaceDeclarations().containsKey(prefix)) {
      final XmlAttribute attribute = tag.getAttribute("xmlns:" + prefix, "");
      final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length());
      return new SchemaPrefix(attribute, textRange, prefix);
    }
    tag = tag.getParentTag();
  }
  return null;
}
项目:consulo-xml    文件:PrefixReferenceProvider.java   
@Override
public boolean isReferenceTo(PsiElement element) {
  if (element instanceof SchemaPrefix && element.getContainingFile() == myElement.getContainingFile()) {
    final PsiElement e = resolve();
    if (e instanceof SchemaPrefix) {
      final String s = ((SchemaPrefix)e).getName();
      return s != null && s.equals(((SchemaPrefix)element).getName());
    }
  }
  return super.isReferenceTo(element);
}
项目:consulo-xml    文件:XmlDocumentationProvider.java   
@Nullable
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
  if (element instanceof SchemaPrefix) {
    return ((SchemaPrefix)element).getQuickNavigateInfo();
  }
  return null;
}
项目:consulo-xml    文件:HtmlDocumentationProvider.java   
@Nullable
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
  if (element instanceof SchemaPrefix) {
    return ((SchemaPrefix)element).getQuickNavigateInfo();
  }
  return null;
}
项目:consulo-xml    文件:XmlRefCountHolder.java   
private void visitOuterLanguageElement(@NotNull final PsiElement element) {
  myHolder.registerOuterLanguageElement(element);
  PsiReference[] references = element.getReferences();
  for (PsiReference reference : references) {
    if (reference instanceof PossiblePrefixReference && ((PossiblePrefixReference)reference).isPrefixReference()) {
      PsiElement resolve = reference.resolve();
      if (resolve instanceof SchemaPrefix) {
        myHolder.addUsedPrefix(((SchemaPrefix)resolve).getName());
      }
    }
  }
}
项目:intellij-ce-playground    文件:XmlRefCountHolder.java   
@Override
public void visitXmlAttributeValue(final XmlAttributeValue value) {
  final PsiElement element = value.getParent();
  if (!(element instanceof XmlAttribute)) return;

  final XmlAttribute attribute = (XmlAttribute)element;

  final XmlTag tag = attribute.getParent();
  if (tag == null) return;

  final XmlElementDescriptor descriptor = tag.getDescriptor();
  if (descriptor == null) return;

  final XmlAttributeDescriptor attributeDescriptor = descriptor.getAttributeDescriptor(attribute);
  if (attributeDescriptor != null) {
    if (attributeDescriptor.hasIdType()) {
      updateMap(attribute, value, false);
    }
    else {
      final PsiReference[] references = value.getReferences();
      for (PsiReference r : references) {
        if (r instanceof IdReferenceProvider.GlobalAttributeValueSelfReference /*&& !r.isSoft()*/) {
          updateMap(attribute, value, r.isSoft());
        }
        else if (r instanceof SchemaPrefixReference) {
          SchemaPrefix prefix = ((SchemaPrefixReference)r).resolve();
          if (prefix != null) {
            myHolder.addUsedPrefix(prefix.getName());
          }
        }
      }
    }

    if (attributeDescriptor.hasIdRefType() && PsiTreeUtil.getChildOfType(value, OuterLanguageElement.class) == null) {
      myHolder.registerIdReference(value);
    }
  }

  String s = value.getValue();
  detectPrefix(s);
  super.visitXmlAttributeValue(value);
}
项目:intellij-ce-playground    文件:XmlExtension.java   
@Nullable
public abstract SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix);
项目:intellij-ce-playground    文件:SchemaPrefixRenameHandler.java   
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
  PossiblePrefixReference ref = getReference(file, editor);
  return ref != null && ref.resolve() instanceof SchemaPrefix;
}
项目:tools-idea    文件:XmlExtension.java   
@Nullable
public abstract SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix);
项目:tools-idea    文件:XmlRefCountHolder.java   
@Override
public void visitXmlAttributeValue(final XmlAttributeValue value) {
  final PsiElement element = value.getParent();
  if (!(element instanceof XmlAttribute)) return;

  final XmlAttribute attribute = (XmlAttribute)element;

  final XmlTag tag = attribute.getParent();
  if (tag == null) return;

  final XmlElementDescriptor descriptor = tag.getDescriptor();
  if (descriptor == null) return;

  final XmlAttributeDescriptor attributeDescriptor = descriptor.getAttributeDescriptor(attribute);
  if (attributeDescriptor == null) return;

  if (attributeDescriptor.hasIdType()) {
    updateMap(attribute, value, false);
  }
  else {
    final PsiReference[] references = value.getReferences();
    for (PsiReference r : references) {
      if (r instanceof IdReferenceProvider.GlobalAttributeValueSelfReference /*&& !r.isSoft()*/) {
        updateMap(attribute, value, r.isSoft());
      }
      else if (r instanceof SchemaPrefixReference) {
        SchemaPrefix prefix = ((SchemaPrefixReference)r).resolve();
        if (prefix != null) {
          myHolder.addUsedPrefix(prefix.getName());
        }
      }
    }
  }

  if (attributeDescriptor.hasIdRefType() && PsiTreeUtil.getChildOfType(value, OuterLanguageElement.class) == null) {
    myHolder.registerIdReference(value);
  }

  String s = value.getValue();
  detectPrefix(s);
  super.visitXmlAttributeValue(value);
}
项目:tools-idea    文件:SchemaPrefixRenameHandler.java   
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
  PossiblePrefixReference ref = getReference(file, editor);
  return ref != null && ref.resolve() instanceof SchemaPrefix;
}
项目:consulo-javaee    文件:JspXmlExtension.java   
@Nullable
@Override
public SchemaPrefix getPrefixDeclaration(XmlTag xmlTag, String s)
{
    return null;
}
项目:consulo-xml    文件:XmlExtension.java   
@Nullable
public abstract SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix);
项目:consulo-xml    文件:XmlRefCountHolder.java   
@Override
public void visitXmlAttributeValue(final XmlAttributeValue value) {
  final PsiElement element = value.getParent();
  if (!(element instanceof XmlAttribute)) return;

  final XmlAttribute attribute = (XmlAttribute)element;

  final XmlTag tag = attribute.getParent();
  if (tag == null) return;

  final XmlElementDescriptor descriptor = tag.getDescriptor();
  if (descriptor == null) return;

  final XmlAttributeDescriptor attributeDescriptor = descriptor.getAttributeDescriptor(attribute);
  if (attributeDescriptor != null) {
    if (attributeDescriptor.hasIdType()) {
      updateMap(attribute, value, false);
    }
    else {
      final PsiReference[] references = value.getReferences();
      for (PsiReference r : references) {
        if (r instanceof IdReferenceProvider.GlobalAttributeValueSelfReference /*&& !r.isSoft()*/) {
          updateMap(attribute, value, r.isSoft());
        }
        else if (r instanceof SchemaPrefixReference) {
          SchemaPrefix prefix = ((SchemaPrefixReference)r).resolve();
          if (prefix != null) {
            myHolder.addUsedPrefix(prefix.getName());
          }
        }
      }
    }

    if (attributeDescriptor.hasIdRefType() && PsiTreeUtil.getChildOfType(value, OuterLanguageElement.class) == null) {
      myHolder.registerIdReference(value);
    }
  }

  String s = value.getValue();
  detectPrefix(s);
  super.visitXmlAttributeValue(value);
}
项目:consulo-xml    文件:SchemaPrefixRenameHandler.java   
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
  PossiblePrefixReference ref = getReference(file, editor);
  return ref != null && ref.resolve() instanceof SchemaPrefix;
}