use of org.kohsuke.rngom.digested.DElementPattern in project intellij-community by JetBrains.
the class CompositeDescriptor method getElementsDescriptors.
@Override
public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
final List<XmlElementDescriptor> descriptors = new ArrayList<>(Arrays.asList(super.getElementsDescriptors(context)));
for (DElementPattern pattern : myPatterns) {
final List<DElementPattern> list = ChildElementFinder.find(2, pattern);
descriptors.addAll(Arrays.asList(myNsDescriptor.convertElementDescriptors(list)));
}
return descriptors.toArray(new XmlElementDescriptor[descriptors.size()]);
}
use of org.kohsuke.rngom.digested.DElementPattern in project intellij-community by JetBrains.
the class RngNsDescriptor method convertElementDescriptors.
XmlElementDescriptor[] convertElementDescriptors(List<DElementPattern> patterns) {
patterns = ContainerUtil.findAll(patterns, NamedPatternFilter.INSTANCE);
final Map<QName, List<DElementPattern>> name2patterns = new HashMap<>();
for (DElementPattern pattern : patterns) {
for (QName qName : pattern.getName().listNames()) {
List<DElementPattern> dPatterns = name2patterns.get(qName);
if (dPatterns == null) {
dPatterns = new ArrayList<>();
name2patterns.put(qName, dPatterns);
}
if (!dPatterns.contains(pattern))
dPatterns.add(pattern);
}
}
final List<XmlElementDescriptor> result = new ArrayList<>();
for (QName qName : name2patterns.keySet()) {
final List<DElementPattern> patternList = name2patterns.get(qName);
final XmlElementDescriptor descriptor = findDescriptor(qName, patternList);
if (descriptor != null) {
result.add(descriptor);
}
}
return result.toArray(new XmlElementDescriptor[result.size()]);
}
Aggregations