private static @Nullable IdeView getIdeView(@NotNull Editor e, @NotNull VirtualFile file) {
    Project project = e.getProject();
    if (project == null) return null;
    VirtualFileSystem fs = file.getFileSystem();
    boolean nonPhysical = fs instanceof NonPhysicalFileSystem || fs instanceof TempFileSystemMarker;
    if (nonPhysical && !ApplicationManager.getApplication().isUnitTestMode()) return null;
    return new IdeView() {

      @Override
      public void selectElement(@NotNull PsiElement element) {
        NavigationUtil.activateFileWithPsiElement(element);
      }

      @Override
      public PsiDirectory @NotNull [] getDirectories() {
        PsiDirectory psiDirectory = getOrChooseDirectory();
        return psiDirectory == null ? PsiDirectory.EMPTY_ARRAY : new PsiDirectory[]{psiDirectory};
      }

      @Override
      public PsiDirectory getOrChooseDirectory() {
        VirtualFile parent = !file.isValid() ? null : file.getParent();
        return parent == null ? null : PsiManager.getInstance(project).findDirectory(parent);
      }
    };
  }
private static @Nullable IdeView getIdeView(@NotNull Editor e, @NotNull VirtualFile file)