Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the auto-update problem with TexGroups on Ubuntu Linux and makes the detection of file modifications more reliable #7412

Merged
merged 6 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Path> ev = (WatchEvent<Path>) event;
Path path = ((Path) key.watchable()).resolve(ev.context());
Expand Down Expand Up @@ -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);
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/jabref/model/groups/TexGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ 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;
}

public static TexGroup createWithoutFileMonitoring(String name, GroupHierarchyType context, Path filePath, AuxParser auxParser, FileUpdateMonitor fileMonitor, MetaData metaData) throws IOException {
return new TexGroup(name, context, filePath, auxParser, fileMonitor, metaData);
}

public Path getFilePathResolved() {
return this.filePath;
}

@Override
public boolean contains(BibEntry entry) {
if (keysUsedInAux == null) {
Expand Down