Java 类com.intellij.util.xml.impl.DomApplicationComponent 实例源码

项目:intellij-ce-playground    文件:DomFileIndex.java   
public DomFileIndex() {
  myDataIndexer = new DataIndexer<String, Void, FileContent>() {
    @Override
    @NotNull
    public Map<String, Void> map(@NotNull final FileContent inputData) {
      final Set<String> namespaces = new THashSet<String>();
      final XmlFileHeader header = NanoXmlUtil.parseHeader(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()));
      ContainerUtil.addIfNotNull(header.getPublicId(), namespaces);
      ContainerUtil.addIfNotNull(header.getSystemId(), namespaces);
      ContainerUtil.addIfNotNull(header.getRootTagNamespace(), namespaces);
      final String tagName = header.getRootTagLocalName();
      if (StringUtil.isNotEmpty(tagName)) {
        final THashMap<String, Void> result = new THashMap<String, Void>();
        final DomApplicationComponent component = DomApplicationComponent.getInstance();
        for (final DomFileDescription description : component.getFileDescriptions(tagName)) {
          final String[] strings = description.getAllPossibleRootTagNamespaces();
          if (strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces)) {
            result.put(description.getRootElementClass().getName(), null);
          }
        }
        for (final DomFileDescription description : component.getAcceptingOtherRootTagNameDescriptions()) {
          final String[] strings = description.getAllPossibleRootTagNamespaces();
          if (strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces)) {
            result.put(description.getRootElementClass().getName(), null);
          }
        }
        return result;
      }
      return Collections.emptyMap();
    }
  };
}
项目:tools-idea    文件:DomFileIndex.java   
public DomFileIndex() {
  myDataIndexer = new DataIndexer<String, Void, FileContent>() {
    @Override
    @NotNull
    public Map<String, Void> map(final FileContent inputData) {
      final Set<String> namespaces = new THashSet<String>();
      final XmlFileHeader header = NanoXmlUtil.parseHeader(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()));
      ContainerUtil.addIfNotNull(header.getPublicId(), namespaces);
      ContainerUtil.addIfNotNull(header.getSystemId(), namespaces);
      ContainerUtil.addIfNotNull(header.getRootTagNamespace(), namespaces);
      final String tagName = header.getRootTagLocalName();
      if (StringUtil.isNotEmpty(tagName)) {
        final THashMap<String, Void> result = new THashMap<String, Void>();
        final DomApplicationComponent component = DomApplicationComponent.getInstance();
        for (final DomFileDescription description : component.getFileDescriptions(tagName)) {
          final String[] strings = description.getAllPossibleRootTagNamespaces();
          if (strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces)) {
            result.put(description.getRootElementClass().getName(), null);
          }
        }
        for (final DomFileDescription description : component.getAcceptingOtherRootTagNameDescriptions()) {
          final String[] strings = description.getAllPossibleRootTagNamespaces();
          if (strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces)) {
            result.put(description.getRootElementClass().getName(), null);
          }
        }
        return result;
      }
      return Collections.emptyMap();
    }
  };
}
项目:tools-idea    文件:DomFileIndex.java   
@Override
public int getVersion() {
  final DomApplicationComponent component = DomApplicationComponent.getInstance();
  int result = 0;
  for (DomFileDescription description : component.getAllFileDescriptions()) {
    result += description.getVersion();
    result += description.getRootTagName().hashCode(); // so that a plugin enabling/disabling could trigger the reindexing
  }
  return result;
}
项目:consulo-xml    文件:DomFileIndex.java   
public DomFileIndex()
{
    myDataIndexer = new DataIndexer<String, Void, FileContent>()
    {
        @Override
        @NotNull
        public Map<String, Void> map(final FileContent inputData)
        {
            final Set<String> namespaces = new THashSet<String>();
            final XmlFileHeader header = NanoXmlUtil.parseHeader(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()));
            ContainerUtil.addIfNotNull(namespaces, header.getPublicId());
            ContainerUtil.addIfNotNull(namespaces, header.getSystemId());
            ContainerUtil.addIfNotNull(namespaces, header.getRootTagNamespace());
            final String tagName = header.getRootTagLocalName();
            if(StringUtil.isNotEmpty(tagName))
            {
                final THashMap<String, Void> result = new THashMap<String, Void>();
                final DomApplicationComponent component = DomApplicationComponent.getInstance();
                for(final DomFileDescription description : component.getFileDescriptions(tagName))
                {
                    final String[] strings = description.getAllPossibleRootTagNamespaces();
                    if(strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces))
                    {
                        result.put(description.getRootElementClass().getName(), null);
                    }
                }
                for(final DomFileDescription description : component.getAcceptingOtherRootTagNameDescriptions())
                {
                    final String[] strings = description.getAllPossibleRootTagNamespaces();
                    if(strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces))
                    {
                        result.put(description.getRootElementClass().getName(), null);
                    }
                }
                return result;
            }
            return Collections.emptyMap();
        }
    };
}
项目:magento2-phpstorm-plugin    文件:VirtualTypeIndex.java   
@Override
public int getVersion() {
    return DomApplicationComponent.getInstance().getCumulativeVersion(false);
}
项目:intellij-ce-playground    文件:DomElementAnnotationsManagerImpl.java   
public static void annotate(final DomElement element, final DomElementAnnotationHolder holder, final Class rootClass) {
  final DomElementsAnnotator annotator = DomApplicationComponent.getInstance().getAnnotator(rootClass);
  if (annotator != null) {
    annotator.annotate(element, holder);
  }
}
项目:intellij-ce-playground    文件:DomFileIndex.java   
@Override
public int getVersion() {
  return DomApplicationComponent.getInstance().getCumulativeVersion(false);
}
项目:intellij-ce-playground    文件:DomStubBuilder.java   
@Override
public int getStubVersion() {
  return 21 + DomApplicationComponent.getInstance().getCumulativeVersion(true);
}
项目:tools-idea    文件:DomElementAnnotationsManagerImpl.java   
public static void annotate(final DomElement element, final DomElementAnnotationHolder holder, final Class rootClass) {
  final DomElementsAnnotator annotator = DomApplicationComponent.getInstance().getAnnotator(rootClass);
  if (annotator != null) {
    annotator.annotate(element, holder);
  }
}
项目:consulo-xml    文件:DomElementAnnotationsManagerImpl.java   
public static void annotate(final DomElement element, final DomElementAnnotationHolder holder, final Class rootClass) {
  final DomElementsAnnotator annotator = DomApplicationComponent.getInstance().getAnnotator(rootClass);
  if (annotator != null) {
    annotator.annotate(element, holder);
  }
}
项目:consulo-xml    文件:DomFileIndex.java   
@Override
public int getVersion()
{
    return DomApplicationComponent.getInstance().getCumulativeVersion();
}