private static boolean isPathOutsideProjectContent(
      @NotNull final ProjectFileIndex fileIndex, @NotNull String path) {
    while (!path.isEmpty()) {
      final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path);
      if (file == null) {
        path = PathUtil.getParentPath(path);
      } else {
        return !fileIndex.isInContent(file);
      }
    }

    return false;
  }
 private boolean isInRootModel(@NotNull VirtualFile file) {
   ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(myProject);
   return index.isInContent(file)
       || index.isInLibraryClasses(file)
       || index.isInLibrarySource(file);
 }