@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;
  }
  @Override
  public void onReveal() {
    // Clear previous state.
    clearSelection(); // clear previous selection (highlighted row)
    getView().clearNewFolderName(); // clear previous new folder name

    // Adjust display based on file selection type.
    setDisplaysFiles(displaysFiles());

    folderDetailsPresenter.setCurrentFolder(FileDtos.user(credentials.getUsername()));
  }
 @Override
 public void onReportsSelection() {
   fireEvent(new FolderRequestEvent(FileDtos.reports()));
 }
 @Override
 public void onProjectsSelection() {
   fireEvent(new FolderRequestEvent(FileDtos.projects()));
 }
 @Override
 public void onUsersSelection() {
   fireEvent(new FolderRequestEvent(FileDtos.users()));
 }
 @Override
 public void onFileSystemSelection() {
   fireEvent(new FolderRequestEvent(FileDtos.create()));
 }
 @Override
 public void onProjectHomeSelection() {
   if (project != null) {
     fireEvent(new FolderRequestEvent(FileDtos.project(project)));
   }
 }
 @Override
 public void onUserHomeSelection() {
   fireEvent(new FolderRequestEvent(FileDtos.user(credentials.getUsername())));
 }