boolean (PsiFile file1, PsiFile file2) { if (file1 == file2) return true; if (file1 == null || file2 == null) return false; VirtualFile virtualFile1 = file1.getVirtualFile(); VirtualFile virtualFile2 = file2.getVirtualFile(); if (virtualFile1 == null || virtualFile2 == null) { return ComparatorUtil.equalsNullable(virtualFile1, virtualFile2); } Module module1 = ProjectRootManager.getInstance(file1.getProject()).getFileIndex().getModuleForFile(virtualFile1); Module module2 = ProjectRootManager.getInstance(file2.getProject()).getFileIndex().getModuleForFile(virtualFile2); return module1 == module2; }