String (@NotNull Project project, @NotNull VirtualFile file) { String projectBase = project.getBasePath(); if (StringUtil.isNotEmpty(projectBase)) { String filePath = file.getPath(); if (FileUtil.isAncestor(projectBase, filePath, true)) { String projectDirName = PathUtil.getFileName(projectBase); String relativePath = FileUtil.getRelativePath(projectBase, filePath, '/'); if (StringUtil.isNotEmpty(projectDirName) && StringUtil.isNotEmpty(relativePath)) { return projectDirName + "/" + relativePath; } } } return file.getPath(); }