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

Fix error message related to themeloader #5429

Merged
merged 2 commits into from
Oct 12, 2019
Merged
Changes from 1 commit
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
21 changes: 9 additions & 12 deletions src/main/java/org/jabref/gui/util/ThemeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,20 @@ private void addAndWatchForChanges(Scene scene, URL cssFile, int index) {
scene.getStylesheets().add(index, cssFile.toExternalForm());

try {

// If the file is an ordinary file (i.e. not part of a java runtime bundle), we watch it for changes and turn on live reloading
URI cssUri = cssFile.toURI();
if (!cssUri.toString().contains("jar")) {
if (!cssUri.toString().contains("jrt")) {
LOGGER.debug("CSS URI {}", cssUri);

Path cssPath = Paths.get(cssUri).toAbsolutePath();
// If the file is an ordinary file (i.e. not a resource part of a .jar bundle), we watch it for changes and turn on live reloading
if (!cssUri.toString().contains("jar")) {
LOGGER.info("Enabling live reloading of {}", cssPath);
fileUpdateMonitor.addListenerForFile(cssPath, () -> {
LOGGER.info("Reload css file " + cssFile);
DefaultTaskExecutor.runInJavaFXThread(() -> {
scene.getStylesheets().remove(cssFile.toExternalForm());
scene.getStylesheets().add(index, cssFile.toExternalForm());
});
LOGGER.info("Enabling live reloading of {}", cssPath);
fileUpdateMonitor.addListenerForFile(cssPath, () -> {
LOGGER.info("Reload css file " + cssFile);
tobiasdiez marked this conversation as resolved.
Show resolved Hide resolved
DefaultTaskExecutor.runInJavaFXThread(() -> {
scene.getStylesheets().remove(cssFile.toExternalForm());
scene.getStylesheets().add(index, cssFile.toExternalForm());
});
}
});
}
} catch (IOException | URISyntaxException | UnsupportedOperationException e) {
LOGGER.error("Could not watch css file for changes " + cssFile, e);
Expand Down