@SuppressWarnings("unchecked")
  private static <T extends DomElement> boolean processAll(@NotNull Project project,
                                                           @NotNull String key,
                                                           GlobalSearchScope scope,
                                                           EnumSet<RegistrationType> types,
                                                           Processor<T> processor) {
    RegistrationEntry.RegistrationDomType registrationDomType = ContainerUtil.getFirstItem(types).getRegistrationDomType();

    return processIndexEntries(project, key, scope, types, tag -> {
      final DomElement domElement = DomManager.getDomManager(project).getDomElement(tag);

      T t;
      if (registrationDomType.isUseParentDom()) {
        t = (T)DomUtil.getParentOfType(domElement, registrationDomType.getDomClass(), false);
      }
      else {
        t = (T)ObjectUtils.tryCast(domElement, registrationDomType.getDomClass());
      }
      if (t == null) return true;

      return processor.process(t);
    });
  }
@SuppressWarnings("unchecked")
  private static <T extends DomElement> boolean processAll(@NotNull Project project,
                                                           @NotNull String key,
                                                           GlobalSearchScope scope,
                                                           EnumSet<RegistrationType> types,
                                                           Processor<T> processor)