replace too long paths with "current" (IDEA-63015)

This commit is contained in:
anna
2011-04-19 12:21:35 +02:00
parent eccf357770
commit 5bcd290f87
@@ -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) {