PropertiesFile (@NotNull PropertiesFile file, @NotNull Collection<? extends PropertiesFile> candidates) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return null; String name = virtualFile.getNameWithoutExtension(); String[] parts = name.split("_"); if (parts.length == 1) return null; List<String> partsList = Arrays.asList(parts); for (int i=parts.length-1; i>=1;i--) { String parentName = StringUtil.join(partsList.subList(0, i), "_") + "." + virtualFile.getExtension(); for (PropertiesFile candidate : candidates) { if (parentName.equals(candidate.getName())) return candidate; } } return null; }