Search in sources :

Example 1 with DPattern

use of org.kohsuke.rngom.digested.DPattern in project intellij-community by JetBrains.

the class RngParser method getCachedPattern.

public static DPattern getCachedPattern(final PsiFile descriptorFile, final ErrorHandler eh) {
    final VirtualFile file = descriptorFile.getVirtualFile();
    if (file == null) {
        return parsePattern(descriptorFile, eh, false);
    }
    String url = file.getUrl();
    DPattern pattern = ourCache.get(url);
    if (pattern == null) {
        pattern = parsePattern(descriptorFile, eh, false);
    }
    if (pattern != null) {
        DPattern oldPattern = ourCache.putIfAbsent(url, pattern);
        if (oldPattern != null) {
            return oldPattern;
        }
    }
    return pattern;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DPattern(org.kohsuke.rngom.digested.DPattern)

Example 2 with DPattern

use of org.kohsuke.rngom.digested.DPattern in project intellij-community by JetBrains.

the class CompositeDescriptor method collectAttributeDescriptors.

@Override
protected XmlAttributeDescriptor[] collectAttributeDescriptors(@Nullable XmlTag context) {
    final QName qName = null;
    final DPattern[] patterns;
    if (qName == null) {
        patterns = myPatterns;
    } else {
        final List<DElementPattern> p = ContainerUtil.findAll(myPatterns, pattern -> pattern.getName().contains(qName));
        patterns = p.toArray(new DPattern[p.size()]);
    }
    return computeAttributeDescriptors(AttributeFinder.find(patterns));
}
Also used : QName(javax.xml.namespace.QName) DPattern(org.kohsuke.rngom.digested.DPattern) DElementPattern(org.kohsuke.rngom.digested.DElementPattern)

Aggregations

DPattern (org.kohsuke.rngom.digested.DPattern)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 QName (javax.xml.namespace.QName)1 DElementPattern (org.kohsuke.rngom.digested.DElementPattern)1