@Override
  public VirtualFile @NotNull [] choose(final @Nullable Project project, final VirtualFile @NotNull ... toSelect) {
    init();
    if (myProject == null && project != null) {
      myProject = project;
    }
    if (toSelect.length == 1) {
      restoreSelection(toSelect[0]);
    }
    else if (toSelect.length == 0) {
      restoreSelection(null); // select the last opened file
    }
    else {
      selectInTree(toSelect, true, true);
    }

    show();

    FileChooserUsageCollector.log(this, myChooserDescriptor, myChosenFiles);
    return myChosenFiles;
  }
@Override
  public VirtualFile @NotNull [] choose(final @Nullable Project project, final VirtualFile @NotNull ... toSelect)