protected @Nullable File getFile() {
    VirtualFile selected = myFileSystemTree.getSelectedFile();
    if (selected != null && !selected.isDirectory()) {
      return new File(selected.getPath());
    }

    String path = (selected == null) ? myPathTextField.getTextFieldText() : selected.getPath();
    File dir = new File(path);
    if (!dir.exists()) {
      return null;
    }
    if (dir.isDirectory()) {
      String child = myFileName.getText();
      path = OSAgnosticPathUtil.isAbsolute(child) ? child : FileUtil.join(path, child);
    }

    boolean correctExt = true;
    for (String ext : myDescriptor.getFileExtensions()) {
      correctExt = path.endsWith("." + ext);
      if (correctExt) break;
    }

    if (!correctExt) {
      Object obj = myExtensions.getSelectedItem();
      String selectedExtension = obj == null ? null : obj.toString();
      if (!Strings.isEmpty(selectedExtension)) {
        path += "." + selectedExtension;
      }
    }

    return new File(path);
  }
protected @Nullable File getFile()