当前位置: 首页>>代码示例>>Java>>正文


Java XmlTag.getNSDescriptor方法代码示例

本文整理汇总了Java中com.intellij.psi.xml.XmlTag.getNSDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java XmlTag.getNSDescriptor方法的具体用法?Java XmlTag.getNSDescriptor怎么用?Java XmlTag.getNSDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.xml.XmlTag的用法示例。


在下文中一共展示了XmlTag.getNSDescriptor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDescriptor

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Nullable
@Override
public XmlElementDescriptor getDescriptor(XmlTag xmlTag) {
  final Project project = xmlTag.getProject();
  CatberryProjectConfigurationManager manager = CatberryProjectConfigurationManager.getInstance(project);

  if (!(xmlTag instanceof HtmlTag && manager.isCatberryEnabled())) return null;

  final XmlNSDescriptor nsDescriptor = xmlTag.getNSDescriptor(xmlTag.getNamespace(), false);
  final XmlElementDescriptor descriptor = nsDescriptor != null ? nsDescriptor.getElementDescriptor(xmlTag) : null;
  final boolean special = CatberryConstants.SPECIAL_COMPONENT_NAMES.contains(xmlTag.getName());
  if (descriptor != null && !(descriptor instanceof AnyXmlElementDescriptor || special)) return null;

  final String name = CatberryComponentUtils.normalizeName(xmlTag.getName());
  final PsiFile file = CatberryComponentUtils.findComponent(project, name);
  return file != null ? new CatberryComponentTagDescriptor(xmlTag.getName(), file) : null;
}
 
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:18,代码来源:CatberryComponentTagDescriptorsProvider.java

示例2: collectInformation

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Nullable
@Override
public MyHost collectInformation(@NotNull PsiFile file) {
  if (!(file instanceof XmlFile)) return null;
  final XmlDocument document = ((XmlFile)file).getDocument();
  if (document == null) return null;
  XmlTag rootTag = document.getRootTag();
  XmlNSDescriptor nsDescriptor = rootTag == null ? null : rootTag.getNSDescriptor(rootTag.getNamespace(), false);

  if (nsDescriptor instanceof Validator) {
    //noinspection unchecked
    MyHost host = new MyHost();
    ((Validator<XmlDocument>)nsDescriptor).validate(document, host);
    return host;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XMLExternalAnnotator.java

示例3: checkElementNameEquivalence

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private boolean checkElementNameEquivalence(String localName, String namespace, String fqn, XmlTag context){
  final String localAttrName = XmlUtil.findLocalNameByQualifiedName(fqn);
  if (!localAttrName.equals(localName)) return false;
  final String attrNamespace = context.getNamespaceByPrefix(XmlUtil.findPrefixByQualifiedName(fqn));
  if (attrNamespace.equals(namespace)) return true;

  if(myTargetNamespace == null){
    if(XmlUtil.EMPTY_URI.equals(attrNamespace))
      return true;
  }
  else {
    if (myTargetNamespace.equals(namespace)) return true;
    return context.getNSDescriptor(namespace, true) == this; // schema's targetNamespace could be different from file systemId
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:XmlNSDescriptorImpl.java

示例4: getAttributeDescriptor

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) {
  String caseSensitiveAttributeName =  !myCaseSensitive ? attributeName.toLowerCase() : attributeName;
  XmlAttributeDescriptor descriptor = super.getAttributeDescriptor(caseSensitiveAttributeName, context);
  if (descriptor == null) descriptor = RelaxedHtmlFromSchemaElementDescriptor.getAttributeDescriptorFromFacelets(attributeName, context);
  
  if (descriptor == null) {
    String prefix = XmlUtil.findPrefixByQualifiedName(attributeName);
    
    if ("xml".equals(prefix)) { // todo this is not technically correct dtd document references namespaces but we should handle it at least for xml stuff
      XmlNSDescriptor nsdescriptor = context.getNSDescriptor(XmlUtil.XML_NAMESPACE_URI, true);
      if (nsdescriptor instanceof XmlNSDescriptorImpl) {
        descriptor = ((XmlNSDescriptorImpl)nsdescriptor).getAttribute(
          XmlUtil.findLocalNameByQualifiedName(caseSensitiveAttributeName), XmlUtil.XML_NAMESPACE_URI, context);
      }
    }
  }
  if (descriptor == null && HtmlUtil.isHtml5Context(context)) {
    descriptor = myDelegate.getAttributeDescriptor(attributeName, context);
  }
  return descriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:HtmlElementDescriptorImpl.java

示例5: getElementDescriptor

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
  XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);

  if (LOG.isDebugEnabled()) {
    LOG.debug("Descriptor from rng for tag " +
              tag.getName() +
              " is " +
              (elementDescriptor != null ? elementDescriptor.getClass().getCanonicalName() : "NULL"));
  }

  String namespace;
  if (elementDescriptor == null &&
      !((namespace = tag.getNamespace()).equals(XmlUtil.XHTML_URI))) {
    return new AnyXmlElementDescriptor(
      null,
      XmlUtil.HTML_URI.equals(namespace) ? this : tag.getNSDescriptor(tag.getNamespace(), true)
    );
  }

  return elementDescriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:RelaxedHtmlFromRngNSDescriptor.java

示例6: getElementDescriptor

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) {
  XmlTag parent = contextTag.getParentTag();
  if (parent == null) return null;
  final XmlNSDescriptor descriptor = parent.getNSDescriptor(childTag.getNamespace(), true);
  return descriptor == null ? null : descriptor.getElementDescriptor(childTag);
}
 
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:8,代码来源:CatberryComponentTagDescriptor.java

示例7: getNSDescriptorToSearchIn

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
static @NotNull XmlNSDescriptorImpl getNSDescriptorToSearchIn(XmlTag rootTag, final String name, XmlNSDescriptorImpl defaultNSDescriptor) {
  if (name == null) return defaultNSDescriptor;
  final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(name);

  if (namespacePrefix.length() > 0) {
    final String namespace = rootTag.getNamespaceByPrefix(namespacePrefix);
    final XmlNSDescriptor nsDescriptor = rootTag.getNSDescriptor(namespace, true);

    if (nsDescriptor instanceof XmlNSDescriptorImpl) {
      return (XmlNSDescriptorImpl)nsDescriptor;
    }
  }

  return defaultNSDescriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:XmlNSDescriptorImpl.java

示例8: getCommonAttributeDescriptors

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static XmlAttributeDescriptor[] getCommonAttributeDescriptors(XmlTag context) {
  final XmlNSDescriptor nsDescriptor = context != null ? context.getNSDescriptor(context.getNamespace(), false) : null;
  if (nsDescriptor instanceof HtmlNSDescriptorImpl) {
    XmlElementDescriptor descriptor = ((HtmlNSDescriptorImpl)nsDescriptor).getElementDescriptorByName("div");
    descriptor = descriptor == null ? ((HtmlNSDescriptorImpl)nsDescriptor).getElementDescriptorByName("span") : descriptor;
    if (descriptor != null) {
      return descriptor.getAttributesDescriptors(context);
    }
  }
  return XmlAttributeDescriptor.EMPTY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:HtmlNSDescriptorImpl.java

示例9: getElementDescriptor

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
  XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);

  String namespace;
  if (elementDescriptor == null && 
      !((namespace = tag.getNamespace()).equals(XmlUtil.XHTML_URI))) {
    return new AnyXmlElementDescriptor(
      null, 
      XmlUtil.HTML_URI.equals(namespace) ? this : tag.getNSDescriptor(tag.getNamespace(), true)
    );
  }

  return elementDescriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:RelaxedHtmlFromSchemaNSDescriptor.java

示例10: getRelaxedDescriptor

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static XmlElementDescriptor getRelaxedDescriptor(XmlElementDescriptor base, final XmlTag childTag) {
  final String namespace = childTag.getNamespace();
  final XmlExtension extension = XmlExtension.getExtensionByElement(childTag);
  if(!XmlUtil.XHTML_URI.equals(namespace) && 
     ( base.getContentType() != XmlElementDescriptor.CONTENT_TYPE_EMPTY ||
       (extension != null && extension.isCustomTagAllowed(childTag)) // allow custom tag
     ) ) {
    return new AnyXmlElementDescriptor(base,childTag.getNSDescriptor(namespace,true));
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RelaxedHtmlFromSchemaElementDescriptor.java

示例11: findTypeDescriptorImpl

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Nullable
protected TypeDescriptor findTypeDescriptorImpl(XmlTag rootTag, final String name, String namespace, Set<XmlTag> visited) {
  XmlNSDescriptorImpl responsibleDescriptor = this;
  if (namespace != null && namespace.length() != 0 && !namespace.equals(getDefaultNamespace())) {
    final XmlNSDescriptor nsDescriptor = rootTag.getNSDescriptor(namespace, true);

    if (nsDescriptor instanceof XmlNSDescriptorImpl) {
      responsibleDescriptor = (XmlNSDescriptorImpl)nsDescriptor;
    }
  }

  if (responsibleDescriptor != this) {
    return responsibleDescriptor.findTypeDescriptor(XmlUtil.findLocalNameByQualifiedName(name));
  }

  if (rootTag == null) return null;
  if (visited != null) {
    if (visited.contains(rootTag)) return null;
    visited.add(rootTag);
  }

  final Pair<QNameKey, XmlTag> pair = Pair.create(new QNameKey(name, namespace), rootTag);

  final CachedValue<TypeDescriptor> descriptor = myTypesMap.get(pair);
  if(descriptor != null) {
    TypeDescriptor value = descriptor.getValue();
    if (value == null ||
        ( value instanceof ComplexTypeDescriptor &&
          ((ComplexTypeDescriptor)value).getDeclaration().isValid()
        )
       )
    return value;
  }

  XmlTag[] tags = rootTag.getSubTags();

  if (visited == null) {
    visited = new HashSet<XmlTag>(1);
    visited.add(rootTag);
  }

  return doFindIn(tags, name, namespace, pair, rootTag, visited);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:XmlNSDescriptorImpl.java

示例12: getNSDescriptor

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Nullable
public XmlNSDescriptor getNSDescriptor(final XmlTag element, final String namespace, final boolean strict) {
  return element.getNSDescriptor(namespace, strict);  
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:XmlExtension.java


注:本文中的com.intellij.psi.xml.XmlTag.getNSDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。