Пример #1
0
  @Nullable
  public FileSelection getSelection() {
    FileDto selectedFile = getSelectedFile();
    if (selectedFile == null) return null;

    if (fileSelectionType == FileSelectionType.FILE_OR_FOLDER) {
      return new FileSelection(selectedFile.getPath(), fileSelectionType);
    }

    if (FileDtos.isFile(selectedFile) && fileSelectionType == FileSelectionType.FILE) {
      return new FileSelection(selectedFile.getPath(), fileSelectionType);
    }

    if (FileDtos.isFolder(selectedFile) && fileSelectionType == FileSelectionType.FOLDER) {
      return new FileSelection(selectedFile.getPath(), fileSelectionType);
    }

    return null;
  }