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

Add submodule pull to circle ci and fix theme loading css #4443

Merged
merged 5 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ jobs:
- image: circleci/openjdk:8-jdk
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init
- restore_cache:
keys:
- install4j-{{ checksum "scripts/extract-install4j.sh" }}
Expand All @@ -26,6 +28,8 @@ jobs:
- restore_cache:
key: dependency-cache
- checkout
- run: git submodule sync
- run: git submodule update --init
- restore_cache:
key: install4j-{{ checksum "scripts/extract-install4j.sh" }}
- run: scripts/extract-install4j.sh
Expand All @@ -47,6 +51,8 @@ jobs:
- restore_cache:
key: dependency-cache
- checkout
- run: git submodule sync
- run: git submodule update --init
- restore_cache:
key: install4j-{{ checksum "scripts/extract-install4j.sh" }}
- run: scripts/extract-install4j.sh
Expand Down
27 changes: 15 additions & 12 deletions src/main/java/org/jabref/gui/util/ThemeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public ThemeLoader(FileUpdateMonitor fileUpdateMonitor, JabRefPreferences jabRef
}
}


/**
* Installs the base css file as a stylesheet in the given scene. Changes in the css file lead to a redraw of the
* scene using the new css file.
Expand All @@ -90,17 +89,21 @@ private void addAndWatchForChanges(Scene scene, URL cssFile, int index) {

try {
// 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
Path cssPath = Paths.get(cssFile.toURI());
if (Files.isRegularFile(cssPath)) {
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());
}
);
});

if (cssFile.toURI() != null) {
LOGGER.debug("CSS URI {}", cssFile);

Path cssPath = Paths.get(cssFile.toURI());
if (Files.isRegularFile(cssPath)) {
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());
});
});
}
}
} catch (IOException | URISyntaxException e) {
LOGGER.error("Could not watch css file for changes " + cssFile, e);
Expand Down