8
8
import javafx .scene .control .ButtonType ;
9
9
10
10
import org .jabref .gui .DialogService ;
11
+ import org .jabref .gui .LibraryTab ;
11
12
import org .jabref .gui .autosaveandbackup .BackupManager ;
12
13
import org .jabref .gui .backup .BackupResolverDialog ;
13
14
import org .jabref .gui .collab .DatabaseChange ;
@@ -41,7 +42,8 @@ private BackupUIManager() {
41
42
public static Optional <ParserResult > showRestoreBackupDialog (DialogService dialogService ,
42
43
Path originalPath ,
43
44
PreferencesService preferencesService ,
44
- FileUpdateMonitor fileUpdateMonitor ) {
45
+ FileUpdateMonitor fileUpdateMonitor ,
46
+ LibraryTab libraryTab ) {
45
47
var actionOpt = showBackupResolverDialog (
46
48
dialogService ,
47
49
preferencesService .getExternalApplicationsPreferences (),
@@ -52,7 +54,7 @@ public static Optional<ParserResult> showRestoreBackupDialog(DialogService dialo
52
54
BackupManager .restoreBackup (originalPath , preferencesService .getFilePreferences ().getBackupDirectory ());
53
55
return Optional .empty ();
54
56
} else if (action == BackupResolverDialog .REVIEW_BACKUP ) {
55
- return showReviewBackupDialog (dialogService , originalPath , preferencesService , fileUpdateMonitor );
57
+ return showReviewBackupDialog (dialogService , originalPath , preferencesService , fileUpdateMonitor , libraryTab );
56
58
}
57
59
return Optional .empty ();
58
60
});
@@ -70,7 +72,8 @@ private static Optional<ParserResult> showReviewBackupDialog(
70
72
DialogService dialogService ,
71
73
Path originalPath ,
72
74
PreferencesService preferencesService ,
73
- FileUpdateMonitor fileUpdateMonitor ) {
75
+ FileUpdateMonitor fileUpdateMonitor ,
76
+ LibraryTab libraryTab ) {
74
77
try {
75
78
ImportFormatPreferences importFormatPreferences = preferencesService .getImportFormatPreferences ();
76
79
@@ -88,12 +91,13 @@ private static Optional<ParserResult> showReviewBackupDialog(
88
91
List <DatabaseChange > changes = DatabaseChangeList .compareAndGetChanges (originalDatabase , backupDatabase , changeResolverFactory );
89
92
DatabaseChangesResolverDialog reviewBackupDialog = new DatabaseChangesResolverDialog (
90
93
changes ,
91
- originalDatabase , "Review Backup"
94
+ originalDatabase , "Review Backup" ,
95
+ libraryTab
92
96
);
93
97
var allChangesResolved = dialogService .showCustomDialogAndWait (reviewBackupDialog );
94
98
if (allChangesResolved .isEmpty () || !allChangesResolved .get ()) {
95
99
// In case not all changes are resolved, start from scratch
96
- return showRestoreBackupDialog (dialogService , originalPath , preferencesService , fileUpdateMonitor );
100
+ return showRestoreBackupDialog (dialogService , originalPath , preferencesService , fileUpdateMonitor , libraryTab );
97
101
}
98
102
99
103
// This does NOT return the original ParserResult, but a modified version with all changes accepted or rejected
0 commit comments