void (@NotNull List<? extends PropertiesFile> files, @NotNull Project project, @NotNull Consumer<? super AbstractTreeNode<?>> nodeConsumer, ViewSettings settings) { ResourceBundleManager manager = ResourceBundleManager.getInstance(project); MultiMap<Couple<String>, PropertiesFile> resourceBundles = new MultiMap<>(); MultiMap<CustomResourceBundle, PropertiesFile> customResourceBundles = new MultiMap<>(); for (PropertiesFile file : files) { final CustomResourceBundle customResourceBundle = manager.getCustomResourceBundle(file); if (customResourceBundle != null) { customResourceBundles.putValue(customResourceBundle, file); } else { String extension = file.getVirtualFile().getExtension(); String baseName = manager.getBaseName(file.getContainingFile()); resourceBundles.putValue(Couple.of(baseName, extension), file); } } for (Map.Entry<Couple<String>, Collection<PropertiesFile>> entry : resourceBundles.entrySet()) { Collection<PropertiesFile> bundleFiles = entry.getValue(); PropertiesFile defaultFile = bundleFiles.iterator().next(); nodeConsumer.consume(bundleFiles.size() == 1 ? new PsiFileNode(project, defaultFile.getContainingFile(), settings) : new ResourceBundleNode(project, new ResourceBundleImpl(defaultFile), settings)); } for (Map.Entry<CustomResourceBundle, Collection<PropertiesFile>> entry : customResourceBundles.entrySet()) { Collection<PropertiesFile> bundleFiles = entry.getValue(); if (bundleFiles.size() == 1) { PropertiesFile representative = bundleFiles.iterator().next(); nodeConsumer.consume(new CustomResourceBundlePropertiesFileNode(project, representative.getContainingFile(), settings)); } else { nodeConsumer.consume(new ResourceBundleNode(project, entry.getKey(), settings)); } } }