void (@NotNull Predicate<? super String> fileNameFilter, @NotNull BiConsumer<? super String, ? super Element> consumer) { Set<ClassLoader> visited = Collections.newSetFromMap(new IdentityHashMap<>()); for (IdeaPluginDescriptor plugin : PluginManagerCore.INSTANCE.getPluginSet().getEnabledModules()) { ClassLoader classLoader = plugin.getPluginClassLoader(); if (!(classLoader instanceof UrlClassLoader) || !visited.add(classLoader)) { continue; } try { ((UrlClassLoader)classLoader).processResources("search", fileNameFilter, (name, stream) -> { try { consumer.accept(name, JDOMUtil.load(stream)); } catch (IOException | JDOMException e) { throw new RuntimeException(String.format("Can't parse searchable options '%s' for plugin '%s'", name, plugin.getPluginId().getIdString()), e); } }); } catch (IOException e) { throw new RuntimeException(e); } } // process additional locations LOCATION_EP_NAME.forEachExtensionSafe(provider -> { Path additionalLocation = provider.getAdditionalLocation(); if (additionalLocation == null) { return; } if (Files.isDirectory(additionalLocation)) { try (var stream = Files.list(additionalLocation)) { stream .filter(path -> fileNameFilter.test(path.getFileName().toString())) .forEach(path -> { String fileName = path.getFileName().toString(); try { consumer.accept(fileName, JDOMUtil.load(path)); } catch (IOException | JDOMException e) { throw new RuntimeException(String.format("Can't parse searchable options '%s'", fileName), e); } }); } catch (IOException e) { throw new RuntimeException(e); } } }); }