String (VirtualFile file, Project project) { final ProjectRootManager rootManager = ProjectRootManager.getInstance(project); final VirtualFile[] contentRoots = rootManager.getContentRootsFromAllModules(); for (VirtualFile otherRoot : contentRoots) { if (VfsUtilCore.isAncestor(otherRoot, file, false)) { return VfsUtilCore.getRelativePath(file, otherRoot, '/'); } } return null; }