Skip to content

Commit

Permalink
Fix comment position
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Apr 17, 2024
1 parent e42498d commit 3c17a16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ public DatabaseChangeMonitor(BibDatabaseContext database,
new Action(Localization.lang("Review changes"), event -> {
DatabaseChangesResolverDialog databaseChangesResolverDialog = new DatabaseChangesResolverDialog(changes, database, Localization.lang("External Changes Resolver"));
var areAllChangesResolved = dialogService.showCustomDialogAndWait(databaseChangesResolverDialog);
// In case all changes of the file on disk are merged into the current in-memory file, the file on disk does not differ from the in-memory file
boolean areAllChangesAccepted = databaseChangesResolverDialog.areAllChangesAccepted();
saveState = stateManager.activeTabProperty().get().get();
final NamedCompound ce = new NamedCompound(Localization.lang("Merged external changes"));
changes.stream().filter(DatabaseChange::isAccepted).forEach(change -> change.applyChange(ce));
ce.end();
undoManager.addEdit(ce);
if (areAllChangesResolved.get()) {
if (areAllChangesAccepted) {
if (databaseChangesResolverDialog.areAllChangesAccepted()) {
// In case all changes of the file on disk are merged into the current in-memory file, the file on disk does not differ from the in-memory file
saveState.resetChangedProperties();
} else {
saveState.markBaseChanged();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/dialogs/BackupUIManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ private static Optional<ParserResult> showReviewBackupDialog(
originalDatabase, "Review Backup"
);
var allChangesResolved = dialogService.showCustomDialogAndWait(reviewBackupDialog);
// Here the case of a backup file is handled. If no changes of the backup are merged in, the file stays the same
// In case any change of the backup is accepted, this means, the in-memory file differs from the file on disk (which is not the backup file)
LibraryTab saveState = stateManager.activeTabProperty().get().get();
final NamedCompound CE = new NamedCompound(Localization.lang("Merged external changes"));
changes.stream().filter(DatabaseChange::isAccepted).forEach(change -> change.applyChange(CE));
CE.end();
undoManager.addEdit(CE);
if (allChangesResolved.get()) {
if (reviewBackupDialog.areAllChangesDenied()) {
// Here the case of a backup file is handled: If no changes of the backup are merged in, the file stays the same
saveState.resetChangeMonitor();
} else {
// In case any change of the backup is accepted, this means, the in-memory file differs from the file on disk (which is not the backup file)
saveState.markBaseChanged();
}
// This does NOT return the original ParserResult, but a modified version with all changes accepted or rejected
Expand Down

0 comments on commit 3c17a16

Please sign in to comment.