Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.dialogs

public Class BackupUIManager

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.file.Path, java.util.List, .Optional, javafx.scene.control.ButtonType, org.jabref.gui.DialogService, .LibraryTab, .StateManager, org.jabref.gui.autosaveandbackup.BackupManager, org.jabref.gui.backup.BackupResolverDialog, org.jabref.gui.collab.DatabaseChange, .DatabaseChangeList, .DatabaseChangeResolverFactory, .DatabaseChangesResolverDialog, org.jabref.gui.frame.ExternalApplicationsPreferences, org.jabref.gui.preferences.GuiPreferences, org.jabref.gui.util.UiTaskExecutor, org.jabref.logic.importer.ImportFormatPreferences, .OpenDatabase, .ParserResult, org.jabref.logic.l10n.Localization, org.jabref.logic.util.io.BackupFileUtil, org.jabref.model.database.BibDatabase, .BibDatabaseContext, org.jabref.model.util.DummyFileUpdateMonitor, .FileUpdateMonitor, com.google.common.annotations.VisibleForTesting, org.slf4j.Logger, .LoggerFactory

Stores all user dialogs related to BackupManager.

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
markRecoveredIfContentRestored(ParserResult parserResult)

An original that could not be parsed at all (e.g. it still contains merge conflict markers) leaves its ParserResult marked invalid, and the caller reports that as an open error and closes the tab.

private static Optional<ButtonType>
showBackupResolverDialog(DialogService dialogService, ExternalApplicationsPreferences externalApplicationsPreferences, Path originalPath, Path backupDir)

public static Optional<ParserResult>
showRestoreBackupDialog(DialogService dialogService, Path originalPath, GuiPreferences preferences, FileUpdateMonitor fileUpdateMonitor, StateManager stateManager)

private static Optional<ParserResult>
showReviewBackupDialog(DialogService dialogService, Path originalPath, GuiPreferences preferences, FileUpdateMonitor fileUpdateMonitor, StateManager stateManager)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

BackupUIManagerback to summary
private BackupUIManager()

Method Detail

markRecoveredIfContentRestoredback to summary
pack-priv static void markRecoveredIfContentRestored(ParserResult parserResult)

An original that could not be parsed at all (e.g. it still contains merge conflict markers) leaves its ParserResult marked invalid, and the caller reports that as an open error and closes the tab. Reviewing a backup merges content into that same result, so the flag has to be cleared once something was actually recovered - otherwise the recovery is discarded right after the user performed it.

Whether a change was accepted is not a sufficient signal: a backup that differs only in its groups produces both a metadata change and a group change, and accepting the metadata change alone restores nothing. So the restored content itself is what decides. If nothing was restored the result stays invalid and the unreadable original is still reported.

Annotations
@VisibleForTesting
showBackupResolverDialogback to summary
private static Optional<ButtonType> showBackupResolverDialog(DialogService dialogService, ExternalApplicationsPreferences externalApplicationsPreferences, Path originalPath, Path backupDir)
showRestoreBackupDialogback to summary
public static Optional<ParserResult> showRestoreBackupDialog(DialogService dialogService, Path originalPath, GuiPreferences preferences, FileUpdateMonitor fileUpdateMonitor, StateManager stateManager)
showReviewBackupDialogback to summary
private static Optional<ParserResult> showReviewBackupDialog(DialogService dialogService, Path originalPath, GuiPreferences preferences, FileUpdateMonitor fileUpdateMonitor, StateManager stateManager)