diff --git a/platform/lang-api/src/com/intellij/analysis/AnalysisScope.java b/platform/lang-api/src/com/intellij/analysis/AnalysisScope.java index eba3184bccba..600dd966e5e7 100644 --- a/platform/lang-api/src/com/intellij/analysis/AnalysisScope.java +++ b/platform/lang-api/src/com/intellij/analysis/AnalysisScope.java @@ -440,10 +440,12 @@ public class AnalysisScope { return AnalysisScopeBundle.message("scope.project", myProject.getName()); case FILE: - return AnalysisScopeBundle.message("scope.file", ProjectUtil.calcRelativeToProjectPath(((PsiFileSystemItem)myElement).getVirtualFile(), myElement.getProject())); + final String relativePath = getRelativePath(); + return relativePath != null ? AnalysisScopeBundle.message("scope.file", relativePath) : "Current File"; case DIRECTORY: - return AnalysisScopeBundle.message("scope.directory", ProjectUtil.calcRelativeToProjectPath(((PsiFileSystemItem)myElement).getVirtualFile(), myElement.getProject())); + final String relativeDirPath = getRelativePath(); + return relativeDirPath != null ? AnalysisScopeBundle.message("scope.directory", relativeDirPath) : "Current Directory"; case VIRTUAL_FILES: @@ -453,6 +455,15 @@ public class AnalysisScope { return ""; } + @Nullable + private String getRelativePath() { + final String relativePath = ProjectUtil.calcRelativeToProjectPath(((PsiFileSystemItem)myElement).getVirtualFile(), myElement.getProject()); + if (relativePath.length() > 100) { + return null; + } + return relativePath; + } + private static String pathToName(String path) { String name = path; if (path != null) {