@Override
  public void choose(@Nullable VirtualFile toSelect, @SuppressWarnings("UsagesOfObsoleteApi") @NotNull Consumer<? super List<VirtualFile>> callback) {
    if (toSelect != null && toSelect.getParent() != null) {
      String directoryName, fileName;
      if (toSelect.isDirectory()) {
        directoryName = toSelect.getCanonicalPath();
        fileName = null;
      }
      else {
        directoryName = toSelect.getParent().getCanonicalPath();
        fileName = toSelect.getPath();
      }
      myFileDialog.setDirectory(directoryName);
      myFileDialog.setFile(fileName);
    }

    myFileDialog.setMultipleMode(myDescriptor.isChooseMultiple());

    myHelper.showNativeDialog(myFileDialog);

    var selectedFiles = myFileDialog.getFiles();
    if (selectedFiles.length != 0) {
      var selectedPaths = Stream.of(selectedFiles).map(File::toPath).toList();
      myChosenFiles = myHelper.selectedFiles(selectedPaths, myParent, myTitle);
      if (myChosenFiles.length != 0) {
        FileChooserUsageCollector.log(this, myDescriptor, myChosenFiles);
        callback.consume(List.of(myChosenFiles));
      }
    }
    else if (callback instanceof FileChooser.FileChooserConsumer) {
      ((FileChooser.FileChooserConsumer)callback).cancelled();
    }
  }
@Override
  public void choose(@Nullable VirtualFile toSelect, @SuppressWarnings("UsagesOfObsoleteApi") @NotNull Consumer<? super List<VirtualFile>> callback)