From c7f8dc4d3d2df7817b4661c56f39aac8a54bf985 Mon Sep 17 00:00:00 2001 From: Joerg Lenhard Date: Fri, 8 Dec 2017 19:37:38 +0100 Subject: [PATCH 1/2] Update internal state of DatabaseChangeMonitor when external changes are resolved --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/BasePanel.java | 2 +- src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a45707b6851..634e59f23f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where double clicking on an entry in the integrity check dialog resulted in an exception [#3485](https://github.com/JabRef/jabref/issues/3485) - We fixed an issue where the entry type could sometimes not be changed when the entry editor was open [#3435](https://github.com/JabRef/jabref/issues/3435) - We fixed an issue where dropping a pdf on the entry table and renaming it triggered an exception [#3490](https://github.com/JabRef/jabref/issues/3490) + - We fixed an issue where integrating external changes to a bib file caused instability [#3498](https://github.com/JabRef/jabref/issues/3498) ### Removed diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java index 7020faa005c..2baaaf701ec 100644 --- a/src/main/java/org/jabref/gui/BasePanel.java +++ b/src/main/java/org/jabref/gui/BasePanel.java @@ -1984,7 +1984,7 @@ public void resetChangeMonitor() { } public void updateTimeStamp() { - changeMonitor.ifPresent(DatabaseChangeMonitor::markAsSaved); + changeMonitor.ifPresent(DatabaseChangeMonitor::updateTimestampAndFileSize); } public Path getTempFile() { diff --git a/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java b/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java index e4ba4845642..e2099e4217b 100644 --- a/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java +++ b/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java @@ -136,9 +136,10 @@ public boolean hasBeenModifiedExternally() { public void markExternalChangesAsResolved() { updatedExternally = false; + updateTimestampAndFileSize(); } - public void markAsSaved() { + public void updateTimestampAndFileSize() { database.getDatabasePath().ifPresent(file -> { try { timeStamp = Files.getLastModifiedTime(file).toMillis(); From 32f96624deeac0c3ada5a78d8e7c7efe2ea46b54 Mon Sep 17 00:00:00 2001 From: Joerg Lenhard Date: Mon, 11 Dec 2017 09:53:07 +0100 Subject: [PATCH 2/2] Change method name back to markAsSaved --- src/main/java/org/jabref/gui/BasePanel.java | 2 +- .../java/org/jabref/gui/collab/DatabaseChangeMonitor.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java index 2baaaf701ec..7020faa005c 100644 --- a/src/main/java/org/jabref/gui/BasePanel.java +++ b/src/main/java/org/jabref/gui/BasePanel.java @@ -1984,7 +1984,7 @@ public void resetChangeMonitor() { } public void updateTimeStamp() { - changeMonitor.ifPresent(DatabaseChangeMonitor::updateTimestampAndFileSize); + changeMonitor.ifPresent(DatabaseChangeMonitor::markAsSaved); } public Path getTempFile() { diff --git a/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java b/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java index e2099e4217b..926bc13fce5 100644 --- a/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java +++ b/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java @@ -136,10 +136,10 @@ public boolean hasBeenModifiedExternally() { public void markExternalChangesAsResolved() { updatedExternally = false; - updateTimestampAndFileSize(); + markAsSaved(); } - public void updateTimestampAndFileSize() { + public void markAsSaved() { database.getDatabasePath().ifPresent(file -> { try { timeStamp = Files.getLastModifiedTime(file).toMillis();