private void selectionChanged() throws FileSystemException {
    LOGGER.debug("Updating selection");
    boolean acceptEnabled = false;
    if (getSelectedFiles().length == 0) {
      acceptEnabled = false;
    } else if (isMultiSelectionEnabled()) {
      boolean filesSelected = false;
      boolean folderSelected = false;

      for (FileObject fo : getSelectedFiles()) {
        FileType fileType = fo.getType();
        if (fileType == FileType.FILE) {
          filesSelected = true;
        } else if (fileType == FileType.FOLDER) {
          folderSelected = true;
        }
      }
      if (selectionMode == SelectionMode.FILES_ONLY && filesSelected && !folderSelected) {
        acceptEnabled = true;
      } else if (selectionMode == SelectionMode.DIRS_ONLY && !filesSelected && folderSelected) {
        acceptEnabled = true;
      } else if (selectionMode == SelectionMode.DIRS_AND_FILES) {
        acceptEnabled = true;
      }
    } else {
      FileObject selectedFileObject = getSelectedFileObject();
      FileType type = selectedFileObject.getType();
      if (selectionMode == SelectionMode.FILES_ONLY && type == FileType.FILE ||
        selectionMode == SelectionMode.DIRS_ONLY && type == FileType.FOLDER) {
        acceptEnabled = true;
      } else if (SelectionMode.DIRS_AND_FILES == selectionMode) {
        acceptEnabled = true;
      }
    }

    if (actionApproveDelegate != null) {
      actionApproveDelegate.setEnabled(acceptEnabled);
    }
    actionApproveButton.setEnabled(acceptEnabled);
  }
Caller responsible for ensuring called from EDT.
We purposefully do not update UI other than indirectly reflecting
the selection.
Current use case is that we are finished with the browser window.
olv-vfs/src/main/java/pl/otros/vfs/browser/VfsBrowser.java