Top Fields Constructors Methods
org.jabref.gui.linkedfile

public Class DeleteFileAction

extends SimpleCommand
Class Inheritance
Annotations
@NullMarked
Imports
java.io.IOException, java.nio.file.Files, .Path, java.util.List, .Optional, javafx.collections.FXCollections, javafx.scene.control.ButtonBar, .ButtonType, .DialogPane, .Label, .ListView, javafx.scene.layout.VBox, org.jabref.gui.DialogService, org.jabref.gui.actions.SimpleCommand, org.jabref.gui.desktop.JabRefDesktop, org.jabref.gui.fieldeditors.LinkedFileViewModel, .LinkedFilesEditorViewModel, org.jabref.gui.icon.IconTheme, .JabRefIconView, org.jabref.gui.util.ViewModelListCellFactory, org.jabref.logic.l10n.Localization, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.LinkedFile, org.jabref.preferences.FilePreferences, org.jspecify.annotations.NullMarked, .Nullable, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final BibDatabaseContext
private final DialogService
private final FilePreferences
private final List<LinkedFileViewModel>
private static final Logger
private boolean
private final @Nullable LinkedFilesEditorViewModel
Inherited from org.jabref.gui.actions.SimpleCommand:
statusMessage

Constructor Summary

AccessConstructor and Description
public
DeleteFileAction(DialogService dialogService, FilePreferences filePreferences, BibDatabaseContext databaseContext, @Nullable LinkedFilesEditorViewModel viewModel, List<LinkedFileViewModel> filesToDelete)

public
DeleteFileAction(DialogService dialogService, FilePreferences filePreferences, BibDatabaseContext databaseContext, List<LinkedFileViewModel> filesToDelete)

Called when the user wants to delete a complete entry.

Method Summary

Modifier and TypeMethod and Description
private DialogPane
private void
deleteFileHelper(BibDatabaseContext databaseContext, LinkedFile
The LinkedFile (file which linked to an entry) to be deleted from disk
linkedFile
)

Helper method to delete the specified file from disk

private void
deleteFiles(boolean
if true, the files are deleted from disk, otherwise they are only removed from the entry
deleteFromDisk
)

Deletes the files from the entry and optionally from disk.

private boolean
public void
public boolean
Inherited from org.jabref.gui.actions.SimpleCommand:
getProgressprogressPropertysetExecutablestatusMessageProperty

Field Detail

databaseContextback to summary
private final BibDatabaseContext databaseContext
dialogServiceback to summary
private final DialogService dialogService
filePreferencesback to summary
private final FilePreferences filePreferences
filesToDeleteback to summary
private final List<LinkedFileViewModel> filesToDelete
LOGGERback to summary
private static final Logger LOGGER
successback to summary
private boolean success
viewModelback to summary
private final @Nullable LinkedFilesEditorViewModel viewModel

Constructor Detail

DeleteFileActionback to summary
public DeleteFileAction(DialogService dialogService, FilePreferences filePreferences, BibDatabaseContext databaseContext, @Nullable LinkedFilesEditorViewModel viewModel, List<LinkedFileViewModel> filesToDelete)
DeleteFileActionback to summary
public DeleteFileAction(DialogService dialogService, FilePreferences filePreferences, BibDatabaseContext databaseContext, List<LinkedFileViewModel> filesToDelete)

Called when the user wants to delete a complete entry.

Method Detail

createDeleteFilesDialogback to summary
private DialogPane createDeleteFilesDialog(String description)
deleteFileHelperback to summary
private void deleteFileHelper(BibDatabaseContext databaseContext, LinkedFile linkedFile)

Helper method to delete the specified file from disk

Parameters
linkedFile:LinkedFile

The LinkedFile (file which linked to an entry) to be deleted from disk

deleteFilesback to summary
private void deleteFiles(boolean deleteFromDisk)

Deletes the files from the entry and optionally from disk.

Parameters
deleteFromDisk:boolean

if true, the files are deleted from disk, otherwise they are only removed from the entry

deletionOfCompleteEntryback to summary
private boolean deletionOfCompleteEntry()
executeback to summary
public void execute()
Annotations
@Override
isSuccessback to summary
public boolean isSuccess()