GroupNodeDescription (final int pattern) { final Set<PsiFile> files = new HashSet<>(); final PsiFragment[] occurrences = getFragmentOccurences(pattern); for (PsiFragment occurrence : occurrences) { final PsiFile file = occurrence.getFile(); if (file != null) { files.add(file); } } final int fileCount = files.size(); final PsiFile psiFile = occurrences[0].getFile(); DuplicatesProfile profile = DuplicatesProfile.findProfileForDuplicate(this, pattern); String comment = profile != null ? profile.getComment(this, pattern) : ""; String filename = psiFile != null ? psiFile.getName() : DupLocatorBundle.message("duplicates.unknown.file.node.title"); final GroupNodeDescription description = new GroupNodeDescription(fileCount, filename, comment); myPattern2Description.put(pattern, description); return description; }