Comparable (@NotNull PsiElement element, @NotNull ProximityLocation location) { Project project = location.getProject(); if (project == null) return 0; VirtualFile file = PsiUtilCore.getVirtualFile(element); if (file == null) return 0; ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); if (fileIndex.isUnderSourceRootOfType(file, Collections.singleton(JavaSourceRootType.SOURCE))) return 3; if (fileIndex.isUnderSourceRootOfType(file, Collections.singleton(JavaSourceRootType.TEST_SOURCE))) return 2; if (fileIndex.isUnderSourceRootOfType(file, ContainerUtil.newHashSet(JavaResourceRootType.RESOURCE, JavaResourceRootType.TEST_RESOURCE))) return 1; return 0; }