diff --git a/CHANGELOG.md b/CHANGELOG.md index a695303ffa2..afa6c5ad057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where the file path is invisible in dark theme. [#7382](https://github.com/JabRef/jabref/issues/7382) - We fixed an issue where the secondary sorting is not working for some special fields. [#7015](https://github.com/JabRef/jabref/issues/7015) - We fixed an issue where changing the font size makes the font size field too small. [#7085](https://github.com/JabRef/jabref/issues/7085) +- We fixed an issue with TexGroups on Linux systems, where the modification of an aux-file did not trigger an auto-update for TexGroups. Furthermore, the detection of file modifications is now more reliable. [#7412](https://github.com/JabRef/jabref/pull/7412) - We fixed an issue where the Unicode to Latex formatter produced wrong results for characters with a codepoint higher than Character.MAX_VALUE. [#7387](https://github.com/JabRef/jabref/issues/7387) ### Removed diff --git a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java index 0dc66b038f8..588e7616b07 100644 --- a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java +++ b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java @@ -56,8 +56,8 @@ public void run() { if (kind == StandardWatchEventKinds.OVERFLOW) { Thread.yield(); continue; - } else if (kind == StandardWatchEventKinds.ENTRY_MODIFY) { - // We only handle "ENTRY_MODIFY" here, so the context is always a Path + } else if (kind == StandardWatchEventKinds.ENTRY_CREATE || kind == StandardWatchEventKinds.ENTRY_MODIFY) { + // We only handle "ENTRY_CREATE" and "ENTRY_MODIFY" here, so the context is always a Path @SuppressWarnings("unchecked") WatchEvent ev = (WatchEvent) event; Path path = ((Path) key.watchable()).resolve(ev.context()); @@ -88,7 +88,7 @@ public void addListenerForFile(Path file, FileUpdateListener listener) throws IO if (isActive()) { // We can't watch files directly, so monitor their parent directory for updates Path directory = file.toAbsolutePath().getParent(); - directory.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); + directory.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY); listeners.put(file, listener); } } diff --git a/src/main/java/org/jabref/model/groups/TexGroup.java b/src/main/java/org/jabref/model/groups/TexGroup.java index 725a180c448..ec77c16530b 100644 --- a/src/main/java/org/jabref/model/groups/TexGroup.java +++ b/src/main/java/org/jabref/model/groups/TexGroup.java @@ -47,7 +47,7 @@ public class TexGroup extends AbstractGroup implements FileUpdateListener { public static TexGroup create(String name, GroupHierarchyType context, Path filePath, AuxParser auxParser, FileUpdateMonitor fileMonitor, MetaData metaData) throws IOException { TexGroup group = new TexGroup(name, context, filePath, auxParser, fileMonitor, metaData); - fileMonitor.addListenerForFile(filePath, group); + fileMonitor.addListenerForFile(group.getFilePathResolved(), group); return group; } @@ -55,6 +55,10 @@ public static TexGroup createWithoutFileMonitoring(String name, GroupHierarchyTy return new TexGroup(name, context, filePath, auxParser, fileMonitor, metaData); } + public Path getFilePathResolved() { + return this.filePath; + } + @Override public boolean contains(BibEntry entry) { if (keysUsedInAux == null) {