XmlElementDescriptor[] convertElementDescriptors(List<? extends DElementPattern> patterns) {
    patterns = ContainerUtil.findAll(patterns, NamedPatternFilter.INSTANCE);

    final Map<QName, List<DElementPattern>> name2patterns = new LinkedHashMap<>();
    for (DElementPattern pattern : patterns) {
      ProgressManager.checkCanceled();

      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(XmlElementDescriptor.EMPTY_ARRAY);
  }
XmlElementDescriptor[] convertElementDescriptors(List<? extends DElementPattern> patterns)