void () { TableCellEditor editor = myTable.getCellEditor(); if (editor != null) editor.cancelCellEditing(); int row = myTable.getSelectedRow(); Object selectedTarget = row >= 0 ? myModel.data.get(myTable.convertRowIndexToModel(row)).first : null; VirtualFile toSelect = myFileToSelect != null ? myFileToSelect : ObjectUtils.tryCast(selectedTarget, VirtualFile.class); FileChooserDescriptor descriptor = new FileChooserDescriptor(!param(ONLY_DIRECTORIES), true, true, true, true, true); FileChooser.chooseFiles(descriptor, myProject, myTable, toSelect, this::doAddFiles); }