From 758020ef51ea21509a76ecf04b56586951a45999 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Fri, 12 Jan 2024 19:02:47 +0100 Subject: [PATCH 1/8] Change default CSL style to ieee-with-url (#10770) * Fix default CSL style to an existing one - Default CSL style is also used for checking for existance - No NPE if no citatation styles are available (but error message) * Remove empty line * Update CitationStyle.java --- .../java/org/jabref/logic/citationstyle/CitationStyle.java | 7 +++++-- .../jabref/logic/citationstyle/JabRefLocaleProvider.java | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java index fb0aab7dc97..0ebd516e5b2 100644 --- a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java +++ b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java @@ -141,8 +141,11 @@ public static List discoverCitationStyles() { return STYLES; } - URL url = CitationStyle.class.getResource(STYLES_ROOT + "/acm-siggraph.csl"); - Objects.requireNonNull(url); + URL url = CitationStyle.class.getResource(STYLES_ROOT + DEFAULT); + if (url == null) { + LOGGER.error("Could not find any citation style. Tried with {}.", DEFAULT); + return Collections.emptyList(); + } try { URI uri = url.toURI(); diff --git a/src/main/java/org/jabref/logic/citationstyle/JabRefLocaleProvider.java b/src/main/java/org/jabref/logic/citationstyle/JabRefLocaleProvider.java index 376303c7caf..142b87bb375 100644 --- a/src/main/java/org/jabref/logic/citationstyle/JabRefLocaleProvider.java +++ b/src/main/java/org/jabref/logic/citationstyle/JabRefLocaleProvider.java @@ -28,7 +28,6 @@ public String retrieveLocale(String lang) { if (url == null) { throw new IllegalArgumentException("Unable to load locale " + locale); } - return CSLUtils.readURLToString(url, "UTF-8"); } catch (IOException e) { throw new UncheckedIOException("failed to read locale " + locale, e); From bf2231943bb1d406d566ce4ef74fe9d0eaccbe07 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 12 Jan 2024 22:13:13 +0100 Subject: [PATCH 2/8] Update add-greeting-to-issue.yml Add also the option to add the label to pr --- .github/workflows/add-greeting-to-issue.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/add-greeting-to-issue.yml b/.github/workflows/add-greeting-to-issue.yml index 5af62f225ce..cb3d6e5640e 100644 --- a/.github/workflows/add-greeting-to-issue.yml +++ b/.github/workflows/add-greeting-to-issue.yml @@ -4,6 +4,9 @@ on: issues: types: - labeled + pull_request: + types: + - labeled jobs: GreetingFirstTimeCodeContribution: From fb52c47c1d32638ac07906fbdea2ee23c1a4947c Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 12 Jan 2024 22:17:22 +0100 Subject: [PATCH 3/8] Update add-greeting-to-issue.yml --- .github/workflows/add-greeting-to-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/add-greeting-to-issue.yml b/.github/workflows/add-greeting-to-issue.yml index cb3d6e5640e..0bc59474337 100644 --- a/.github/workflows/add-greeting-to-issue.yml +++ b/.github/workflows/add-greeting-to-issue.yml @@ -18,7 +18,7 @@ jobs: - name: GreetingFirstTimeCodeContribution uses: peter-evans/create-or-update-comment@v3 with: - issue-number: ${{ github.event.issue.number }} + issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} body: | As a general advice for newcomers: check out [Contributing](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md) for a start. Also, [guidelines for setting up a local workspace](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace) is worth having a look at. From 1ba800f092e2d745f9727665ceba0664d4635360 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 12 Jan 2024 22:22:10 +0100 Subject: [PATCH 4/8] Update add-greeting-to-issue.yml does not work on pr --- .github/workflows/add-greeting-to-issue.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/add-greeting-to-issue.yml b/.github/workflows/add-greeting-to-issue.yml index 0bc59474337..5af62f225ce 100644 --- a/.github/workflows/add-greeting-to-issue.yml +++ b/.github/workflows/add-greeting-to-issue.yml @@ -4,9 +4,6 @@ on: issues: types: - labeled - pull_request: - types: - - labeled jobs: GreetingFirstTimeCodeContribution: @@ -18,7 +15,7 @@ jobs: - name: GreetingFirstTimeCodeContribution uses: peter-evans/create-or-update-comment@v3 with: - issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} + issue-number: ${{ github.event.issue.number }} body: | As a general advice for newcomers: check out [Contributing](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md) for a start. Also, [guidelines for setting up a local workspace](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace) is worth having a look at. From 996157a6b23a3c8acb0b6cf068774d2011d83a30 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sat, 13 Jan 2024 11:18:46 +0100 Subject: [PATCH 5/8] Fix labeling of PRs for newcomers (#10773) --- .github/workflows/add-greeting-to-issue.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/add-greeting-to-issue.yml b/.github/workflows/add-greeting-to-issue.yml index 5af62f225ce..06075eef0e2 100644 --- a/.github/workflows/add-greeting-to-issue.yml +++ b/.github/workflows/add-greeting-to-issue.yml @@ -1,10 +1,13 @@ name: Add greeting to issues for first time contributors -on: +on: issues: types: - labeled - + pull_request_target: + types: + - labeled + jobs: GreetingFirstTimeCodeContribution: if: ${{ github.event.label.name == 'FirstTimeCodeContribution' }} @@ -15,8 +18,8 @@ jobs: - name: GreetingFirstTimeCodeContribution uses: peter-evans/create-or-update-comment@v3 with: - issue-number: ${{ github.event.issue.number }} + issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} body: | As a general advice for newcomers: check out [Contributing](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md) for a start. Also, [guidelines for setting up a local workspace](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace) is worth having a look at. - + Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's [Gitter](https://gitter.im/JabRef/jabref) chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback. From bd27d5db85ceb5b22d3fc0c4fc8587fcd9c485a1 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sat, 13 Jan 2024 12:24:35 +0100 Subject: [PATCH 6/8] Fix package of TypedBibEntry (#10774) --- src/main/java/org/jabref/gui/entryeditor/EntryEditor.java | 2 +- src/main/java/org/jabref/logic/bibtex/BibEntryWriter.java | 1 - src/main/java/org/jabref/logic/{ => bibtex}/TypedBibEntry.java | 2 +- src/main/java/org/jabref/logic/xmp/DublinCoreExtractor.java | 2 +- src/test/java/org/jabref/logic/TypedBibEntryTest.java | 1 + 5 files changed, 4 insertions(+), 4 deletions(-) rename src/main/java/org/jabref/logic/{ => bibtex}/TypedBibEntry.java (98%) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 802c04194b4..98bcf351354 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -45,7 +45,7 @@ import org.jabref.gui.undo.CountingUndoManager; import org.jabref.gui.util.DefaultTaskExecutor; import org.jabref.gui.util.TaskExecutor; -import org.jabref.logic.TypedBibEntry; +import org.jabref.logic.bibtex.TypedBibEntry; import org.jabref.logic.help.HelpFile; import org.jabref.logic.importer.EntryBasedFetcher; import org.jabref.logic.importer.WebFetchers; diff --git a/src/main/java/org/jabref/logic/bibtex/BibEntryWriter.java b/src/main/java/org/jabref/logic/bibtex/BibEntryWriter.java index 663fa3e3fee..eaa23b7f6f2 100644 --- a/src/main/java/org/jabref/logic/bibtex/BibEntryWriter.java +++ b/src/main/java/org/jabref/logic/bibtex/BibEntryWriter.java @@ -14,7 +14,6 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import org.jabref.logic.TypedBibEntry; import org.jabref.logic.exporter.BibWriter; import org.jabref.logic.util.OS; import org.jabref.model.database.BibDatabaseMode; diff --git a/src/main/java/org/jabref/logic/TypedBibEntry.java b/src/main/java/org/jabref/logic/bibtex/TypedBibEntry.java similarity index 98% rename from src/main/java/org/jabref/logic/TypedBibEntry.java rename to src/main/java/org/jabref/logic/bibtex/TypedBibEntry.java index a4da3dbcb80..bbdfd08e69d 100644 --- a/src/main/java/org/jabref/logic/TypedBibEntry.java +++ b/src/main/java/org/jabref/logic/bibtex/TypedBibEntry.java @@ -1,4 +1,4 @@ -package org.jabref.logic; +package org.jabref.logic.bibtex; import java.util.Objects; import java.util.Optional; diff --git a/src/main/java/org/jabref/logic/xmp/DublinCoreExtractor.java b/src/main/java/org/jabref/logic/xmp/DublinCoreExtractor.java index 8df2f2ed770..f79c5d5616c 100644 --- a/src/main/java/org/jabref/logic/xmp/DublinCoreExtractor.java +++ b/src/main/java/org/jabref/logic/xmp/DublinCoreExtractor.java @@ -9,7 +9,7 @@ import java.util.function.Consumer; import java.util.function.Predicate; -import org.jabref.logic.TypedBibEntry; +import org.jabref.logic.bibtex.TypedBibEntry; import org.jabref.logic.formatter.casechanger.UnprotectTermsFormatter; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseMode; diff --git a/src/test/java/org/jabref/logic/TypedBibEntryTest.java b/src/test/java/org/jabref/logic/TypedBibEntryTest.java index 683d636e7c2..18ec51769db 100644 --- a/src/test/java/org/jabref/logic/TypedBibEntryTest.java +++ b/src/test/java/org/jabref/logic/TypedBibEntryTest.java @@ -1,5 +1,6 @@ package org.jabref.logic; +import org.jabref.logic.bibtex.TypedBibEntry; import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibEntryTypesManager; From 46ece6f627340633004725ea48b7fd2d6e664368 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sat, 13 Jan 2024 14:11:35 +0100 Subject: [PATCH 7/8] Fix enablement of Aux dialog's "Generate" button (#10775) * Fix enablement of Aux dialog's "Generate" button * Add link to PR --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/auximport/FromAuxDialog.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 744c6d801b0..bcbd2265a9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - The index directories for full text search have now more readable names to increase debugging possibilities using Apache Lucense's Lurk. [#10193](https://github.com/JabRef/jabref/issues/10193) - The fulltext search also indexes files ending with .pdf (but do not having an explicit file type set). [#10193](https://github.com/JabRef/jabref/issues/10193) - We changed the order of the lists in the "Citation relations" tab. `Cites` are now on the left and `Cited by` on the right [#10572](https://github.com/JabRef/jabref/pull/10752) +- Sub libraries based on `aux` file can now also be generated if some citeations are not found library. [#10775](https://github.com/JabRef/jabref/pull/10775) ### Fixed diff --git a/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java b/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java index 02e947dc0f0..7a16c262b71 100644 --- a/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java +++ b/src/main/java/org/jabref/gui/auximport/FromAuxDialog.java @@ -49,7 +49,7 @@ public FromAuxDialog(LibraryTabContainer tabContainer) { .setAsDialogPane(this); Button generateButton = (Button) this.getDialogPane().lookupButton(generateButtonType); - generateButton.disableProperty().bind(viewModel.parseFailedProperty().or(viewModel.notFoundList().emptyProperty().not())); + generateButton.disableProperty().bind(viewModel.parseFailedProperty()); generateButton.defaultButtonProperty().bind(generateButton.disableProperty().not()); setResultConverter(button -> { if (button == generateButtonType) { From aa41185115fb0e25446ff471f75cc7c33f2d3ce8 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 13 Jan 2024 20:42:14 +0100 Subject: [PATCH 8/8] Add wokraround for theme detector issue (#10777) Fixes #10767 --- .../org/jabref/gui/theme/ThemeManager.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/theme/ThemeManager.java b/src/main/java/org/jabref/gui/theme/ThemeManager.java index d92586a615d..0c18f2fd658 100644 --- a/src/main/java/org/jabref/gui/theme/ThemeManager.java +++ b/src/main/java/org/jabref/gui/theme/ThemeManager.java @@ -48,9 +48,10 @@ public class ThemeManager { private final StyleSheet baseStyleSheet; private Theme theme; + private OsThemeDetector detector; + private Scene mainWindowScene; private final Set webEngines = Collections.newSetFromMap(new WeakHashMap<>()); - private final OsThemeDetector detector = OsThemeDetector.getDetector(); public ThemeManager(WorkspacePreferences workspacePreferences, FileUpdateMonitor fileUpdateMonitor, @@ -71,13 +72,20 @@ public ThemeManager(WorkspacePreferences workspacePreferences, EasyBind.subscribe(workspacePreferences.themeSyncOsProperty(), theme -> updateThemeSettings()); EasyBind.subscribe(workspacePreferences.shouldOverrideDefaultFontSizeProperty(), should -> updateFontSettings()); EasyBind.subscribe(workspacePreferences.mainFontSizeProperty(), size -> updateFontSettings()); - detector.registerListener(isDark -> updateThemeSettings()); + + try { + detector = OsThemeDetector.getDetector(); + detector.registerListener(isDark -> updateThemeSettings()); + } catch (Exception ex) { + LOGGER.error("Could not initialize Theme detector!", ex); + workspacePreferences.setThemeSyncOs(false); + } } private void updateThemeSettings() { Theme newTheme = Objects.requireNonNull(workspacePreferences.getTheme()); - if (workspacePreferences.themeSyncOsProperty().getValue()) { + if (workspacePreferences.themeSyncOsProperty().getValue() && detector != null) { if (detector.isDark()) { newTheme = Theme.dark(); } else { @@ -162,10 +170,10 @@ private void updateBaseCss() { getMainWindowScene().ifPresent(scene -> { List stylesheets = scene.getStylesheets(); if (!stylesheets.isEmpty()) { - stylesheets.remove(0); + stylesheets.removeFirst(); } - stylesheets.add(0, baseStyleSheet.getSceneStylesheet().toExternalForm()); + stylesheets.addFirst(baseStyleSheet.getSceneStylesheet().toExternalForm()); }); }