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(); } }; }
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(); } }; }
@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; }
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(); } }; }
@Override public int getVersion() { return DomApplicationComponent.getInstance().getCumulativeVersion(false); }
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); } }
@Override public int getStubVersion() { return 21 + DomApplicationComponent.getInstance().getCumulativeVersion(true); }
@Override public int getVersion() { return DomApplicationComponent.getInstance().getCumulativeVersion(); }