From beded44407b8c956845c3876253b067b9c43f62b Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 14 Oct 2024 15:31:13 +0200 Subject: [PATCH 01/50] Fix typo (#11956) --- docs/code-howtos/http-server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/code-howtos/http-server.md b/docs/code-howtos/http-server.md index 1543e460fa20..295c02aad402 100644 --- a/docs/code-howtos/http-server.md +++ b/docs/code-howtos/http-server.md @@ -3,7 +3,7 @@ parent: Code Howtos --- # HTTP Server -JabRef has a build in http server. +JabRef has a built-in http server. For example, the resource for a library is implemented at [`org.jabref.http.server.LibraryResource`](https://github.com/JabRef/jabref/blob/main/src/main/java/org/jabref/http/server/LibraryResource.java). ## Start http server From 6724899c9a9a52a665efc64decf72590b2c9bf4d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:16:52 +0000 Subject: [PATCH 02/50] Bump buildres/abbrv.jabref.org from `6ec4cd0` to `d870374` (#11957) Bumps [buildres/abbrv.jabref.org](https://github.com/JabRef/abbrv.jabref.org) from `6ec4cd0` to `d870374`. - [Release notes](https://github.com/JabRef/abbrv.jabref.org/releases) - [Commits](https://github.com/JabRef/abbrv.jabref.org/compare/6ec4cd0ea474313bc39e0d81aae43a9e8b598f21...d87037495de7213b896dbb6a20170387de170709) --- updated-dependencies: - dependency-name: buildres/abbrv.jabref.org dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- buildres/abbrv.jabref.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildres/abbrv.jabref.org b/buildres/abbrv.jabref.org index 6ec4cd0ea474..d87037495de7 160000 --- a/buildres/abbrv.jabref.org +++ b/buildres/abbrv.jabref.org @@ -1 +1 @@ -Subproject commit 6ec4cd0ea474313bc39e0d81aae43a9e8b598f21 +Subproject commit d87037495de7213b896dbb6a20170387de170709 From beb1175f7a451d513b5660751df11fcafbeec841 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:21:34 +0000 Subject: [PATCH 03/50] Bump src/main/resources/csl-styles from `1e20dd6` to `b413a77` (#11958) Bumps [src/main/resources/csl-styles](https://github.com/citation-style-language/styles) from `1e20dd6` to `b413a77`. - [Release notes](https://github.com/citation-style-language/styles/releases) - [Commits](https://github.com/citation-style-language/styles/compare/1e20dd605e3db1d87a5426eada0a6b1fe4fe52e6...b413a778b8170cf5aebbb9aeffec62cfd068e19e) --- updated-dependencies: - dependency-name: src/main/resources/csl-styles dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/main/resources/csl-styles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/csl-styles b/src/main/resources/csl-styles index 1e20dd605e3d..b413a778b817 160000 --- a/src/main/resources/csl-styles +++ b/src/main/resources/csl-styles @@ -1 +1 @@ -Subproject commit 1e20dd605e3db1d87a5426eada0a6b1fe4fe52e6 +Subproject commit b413a778b8170cf5aebbb9aeffec62cfd068e19e From 53c03e695470de8d6d6bfdad6984f9b634e57d45 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:28:56 +0000 Subject: [PATCH 04/50] Bump com.dlsc.gemsfx:gemsfx from 2.51.0 to 2.58.0 (#11959) Bumps [com.dlsc.gemsfx:gemsfx](https://github.com/dlsc-software-consulting-gmbh/GemsFX) from 2.51.0 to 2.58.0. - [Release notes](https://github.com/dlsc-software-consulting-gmbh/GemsFX/releases) - [Changelog](https://github.com/dlsc-software-consulting-gmbh/GemsFX/blob/master/jreleaser.yml) - [Commits](https://github.com/dlsc-software-consulting-gmbh/GemsFX/compare/v2.51.0...v2.58.0) --- updated-dependencies: - dependency-name: com.dlsc.gemsfx:gemsfx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b7b3eef0252e..4d4018c5993d 100644 --- a/build.gradle +++ b/build.gradle @@ -238,7 +238,7 @@ dependencies { } implementation 'org.fxmisc.flowless:flowless:0.7.3' implementation 'org.fxmisc.richtext:richtextfx:0.11.3' - implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.51.0') { + implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.58.0') { exclude module: 'javax.inject' // Split package, use only jakarta.inject exclude module: 'commons-lang3' exclude group: 'org.apache.commons.validator' From d0d38ae9b63fad0f9016b098d3ccad2cb26b26cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:30:53 +0000 Subject: [PATCH 05/50] Bump org.glassfish.jersey.core:jersey-server from 3.1.8 to 3.1.9 (#11961) Bumps org.glassfish.jersey.core:jersey-server from 3.1.8 to 3.1.9. --- updated-dependencies: - dependency-name: org.glassfish.jersey.core:jersey-server dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4d4018c5993d..d0e2b190ccdb 100644 --- a/build.gradle +++ b/build.gradle @@ -302,7 +302,7 @@ dependencies { // API implementation 'jakarta.ws.rs:jakarta.ws.rs-api:4.0.0' // Implementation of the API - implementation 'org.glassfish.jersey.core:jersey-server:3.1.8' + implementation 'org.glassfish.jersey.core:jersey-server:3.1.9' // injection framework implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.8' implementation 'org.glassfish.hk2:hk2-api:3.1.1' From 0b4b40cea8b2240143c958c0be6e4d669f7c4a57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:35:22 +0000 Subject: [PATCH 06/50] Bump io.github.classgraph:classgraph from 4.8.176 to 4.8.177 (#11962) Bumps [io.github.classgraph:classgraph](https://github.com/classgraph/classgraph) from 4.8.176 to 4.8.177. - [Release notes](https://github.com/classgraph/classgraph/releases) - [Commits](https://github.com/classgraph/classgraph/compare/classgraph-4.8.176...classgraph-4.8.177) --- updated-dependencies: - dependency-name: io.github.classgraph:classgraph dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d0e2b190ccdb..175f581f61bf 100644 --- a/build.gradle +++ b/build.gradle @@ -370,7 +370,7 @@ dependencies { // Even if "compileOnly" is used, IntelliJ always adds to module-info.java. To avoid issues during committing, we use "implementation" instead of "compileOnly" implementation 'io.github.adr:e-adr:2.0.0-SNAPSHOT' - testImplementation 'io.github.classgraph:classgraph:4.8.176' + testImplementation 'io.github.classgraph:classgraph:4.8.177' testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0' testImplementation 'org.junit.platform:junit-platform-launcher:1.10.3' From 7a3638a69a696fe48e256bcf28b4462ca14eedd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:54:50 +0000 Subject: [PATCH 07/50] Bump thollander/actions-comment-pull-request from 2 to 3 (#11964) Bumps [thollander/actions-comment-pull-request](https://github.com/thollander/actions-comment-pull-request) from 2 to 3. - [Release notes](https://github.com/thollander/actions-comment-pull-request/releases) - [Commits](https://github.com/thollander/actions-comment-pull-request/compare/v2...v3) --- updated-dependencies: - dependency-name: thollander/actions-comment-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/cleanup-pr.yml | 2 +- .github/workflows/deployment.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cleanup-pr.yml b/.github/workflows/cleanup-pr.yml index fae66fb01c71..5c816f920fa0 100644 --- a/.github/workflows/cleanup-pr.yml +++ b/.github/workflows/cleanup-pr.yml @@ -37,7 +37,7 @@ jobs: key: ${{ secrets.buildJabRefPrivateKey }} - name: Update PR comment if: steps.checksecrets.outputs.secretspresent == 'YES' - uses: thollander/actions-comment-pull-request@v2 + uses: thollander/actions-comment-pull-request@v3 with: comment_tag: download-link message: The build for this PR is no longer available. Please visit for the latest build. diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 7bd460fd4d6e..0b015838d63f 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -287,7 +287,7 @@ jobs: BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }} - name: Comment PR if: (steps.checksecrets.outputs.secretspresent == 'YES') - uses: thollander/actions-comment-pull-request@v2 + uses: thollander/actions-comment-pull-request@v3 with: message: | The build of this PR is available at . From 99d5bb9a0b16e9ff103b27da9cb0150be6b02985 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:58:19 +0000 Subject: [PATCH 08/50] Bump lycheeverse/lychee-action from 1.10.0 to 2.0.2 (#11965) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.10.0 to 2.0.2. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.10.0...v2.0.2) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml index ccb056e9bec1..67881841c462 100644 --- a/.github/workflows/check-links.yml +++ b/.github/workflows/check-links.yml @@ -31,7 +31,7 @@ jobs: restore-keys: cache-lychee- - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.10.0 + uses: lycheeverse/lychee-action@v2.0.2 with: fail: true args: --accept '200,201,202,203,204,403,429,500' --max-concurrency 1 --cache --no-progress --exclude-all-private './**/*.md' From e0cd309915c515821e6ddf97ab822f7715903210 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:55:14 +0000 Subject: [PATCH 09/50] Bump org.glassfish.jersey.containers:jersey-container-grizzly2-http (#11963) Bumps org.glassfish.jersey.containers:jersey-container-grizzly2-http from 3.1.8 to 3.1.9. --- updated-dependencies: - dependency-name: org.glassfish.jersey.containers:jersey-container-grizzly2-http dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oliver Kopp --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 175f581f61bf..a72488e7b50d 100644 --- a/build.gradle +++ b/build.gradle @@ -311,7 +311,7 @@ dependencies { // testImplementation 'org.glassfish.hk2:hk2-junitrunner:3.0.4' // HTTP server // implementation 'org.glassfish.jersey.containers:jersey-container-netty-http:3.1.1' - implementation 'org.glassfish.jersey.containers:jersey-container-grizzly2-http:3.1.8' + implementation 'org.glassfish.jersey.containers:jersey-container-grizzly2-http:3.1.9' testImplementation 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:3.1.8' // Allow objects "magically" to be mapped to JSON using GSON // implementation 'org.glassfish.jersey.media:jersey-media-json-gson:3.1.1' From d03c7a59e731fa1f60510b9531815e8bf8476064 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:10:31 +0200 Subject: [PATCH 10/50] Added double click to jump to entry in CitationRelationsTab (#11955) * Added double click to jump to entry in CitationRelationsTab * CHANGELOG.md --------- Co-authored-by: Oliver Kopp --- CHANGELOG.md | 1 + .../CitationRelationsTab.java | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c84f5424c47..73e2aad2458a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added a different background color to the search bar to indicate when the search syntax is wrong. [#11658](https://github.com/JabRef/jabref/pull/11658) - We added a setting which always adds the literal "Cited on pages" text before each JStyle citation. [#11691](https://github.com/JabRef/jabref/pull/11732) - We added a new plain citation parser that uses LLMs. [#11825](https://github.com/JabRef/jabref/issues/11825) +- By double clicking on a local citation in the Citation Relations Tab you can now jump the the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955) ### Changed diff --git a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java index 3ab2a167b9c4..48403a3d16dc 100644 --- a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java @@ -231,11 +231,11 @@ private void styleFetchedListView(CheckListView listView) Button jumpTo = IconTheme.JabRefIcons.LINK.asButton(); jumpTo.setTooltip(new Tooltip(Localization.lang("Jump to entry in library"))); jumpTo.getStyleClass().add("addEntryButton"); - jumpTo.setOnMouseClicked(event -> { - citingTask.cancel(); - citedByTask.cancel(); - libraryTab.showAndEdit(entry.localEntry()); - libraryTab.clearAndSelect(entry.localEntry()); + jumpTo.setOnMouseClicked(event -> jumpToEntry(entry)); + hContainer.setOnMouseClicked(event -> { + if (event.getClickCount() == 2) { + jumpToEntry(entry); + } }); vContainer.getChildren().add(jumpTo); } else { @@ -295,6 +295,13 @@ private void styleFetchedListView(CheckListView listView) listView.setSelectionModel(new NoSelectionModel<>()); } + private void jumpToEntry(CitationRelationItem entry) { + citingTask.cancel(); + citedByTask.cancel(); + libraryTab.showAndEdit(entry.localEntry()); + libraryTab.clearAndSelect(entry.localEntry()); + } + /** * @implNote This code is similar to {@link PreviewWithSourceTab#getSourceString(BibEntry, BibDatabaseMode, FieldPreferences, BibEntryTypesManager)}. */ From 049cf435d693cc7a67ba2fcfe1728ecb744c674b Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 14 Oct 2024 21:07:45 +0200 Subject: [PATCH 11/50] Add change of state on assignment (#11952) --- ...to-issue.yml => react-on-issue-labels.yml} | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) rename .github/workflows/{add-greeting-to-issue.yml => react-on-issue-labels.yml} (61%) diff --git a/.github/workflows/add-greeting-to-issue.yml b/.github/workflows/react-on-issue-labels.yml similarity index 61% rename from .github/workflows/add-greeting-to-issue.yml rename to .github/workflows/react-on-issue-labels.yml index e03ca9f8ba69..b7ada31e9538 100644 --- a/.github/workflows/add-greeting-to-issue.yml +++ b/.github/workflows/react-on-issue-labels.yml @@ -1,4 +1,4 @@ -name: Add greeting to issues for first time contributors +name: React on issue labels on: issues: @@ -9,7 +9,8 @@ on: - labeled jobs: - GreetingFirstTimeCodeContribution: + FirstTimeCodeContribution: + name: Add greeting to issues for first time contributors if: ${{ github.event.label.name == 'FirstTimeCodeContribution' }} runs-on: ubuntu-latest permissions: @@ -29,3 +30,19 @@ jobs: Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on [JabRef's Gitter chat](https://gitter.im/JabRef/jabref). And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback. Happy coding! 🚀 + - name: Move Issue to "Assigned" Column in "Candidates for University Projects" + uses: m7kvqbe1/github-action-move-issues@v1.0.0 + with: + github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }} + project-url: "https://github.com/orgs/JabRef/projects/3" + target-labels: "FirstTimeCodeContribution" + target-column: "Assigned" + ignored-columns: "" + - name: Move Issue to "Assigned" Column in "Good First Issues" + uses: m7kvqbe1/github-action-move-issues@v1.0.0 + with: + github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }} + project-url: "https://github.com/orgs/JabRef/projects/5" + target-labels: "FirstTimeCodeContribution" + target-column: "Assigned" + ignored-columns: "" From fc0a748b70c1a78b97091f5a65bf1a4e0fd3ce28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:05:47 +0000 Subject: [PATCH 12/50] Bump luceneVersion from 9.12.0 to 10.0.0 (#11960) * Bump luceneVersion from 9.12.0 to 10.0.0 Bumps `luceneVersion` from 9.12.0 to 10.0.0. Updates `org.apache.lucene:lucene-core` from 9.12.0 to 10.0.0 Updates `org.apache.lucene:lucene-queryparser` from 9.12.0 to 10.0.0 Updates `org.apache.lucene:lucene-queries` from 9.12.0 to 10.0.0 Updates `org.apache.lucene:lucene-analysis-common` from 9.12.0 to 10.0.0 Updates `org.apache.lucene:lucene-highlighter` from 9.12.0 to 10.0.0 --- updated-dependencies: - dependency-name: org.apache.lucene:lucene-core dependency-type: direct:production update-type: version-update:semver-major - dependency-name: org.apache.lucene:lucene-queryparser dependency-type: direct:production update-type: version-update:semver-major - dependency-name: org.apache.lucene:lucene-queries dependency-type: direct:production update-type: version-update:semver-major - dependency-name: org.apache.lucene:lucene-analysis-common dependency-type: direct:production update-type: version-update:semver-major - dependency-name: org.apache.lucene:lucene-highlighter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * fix lucene --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Siedlerchr --- build.gradle | 2 +- src/main/java/module-info.java | 2 +- .../java/org/jabref/logic/search/retrieval/LuceneSearcher.java | 2 +- src/main/java/org/jabref/model/search/SearchFieldConstants.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index a72488e7b50d..65b5d22bb38c 100644 --- a/build.gradle +++ b/build.gradle @@ -166,7 +166,7 @@ dependencies { exclude group: 'commons-logging' } - def luceneVersion = "9.12.0" + def luceneVersion = "10.0.0" implementation "org.apache.lucene:lucene-core:$luceneVersion" implementation "org.apache.lucene:lucene-queryparser:$luceneVersion" implementation "org.apache.lucene:lucene-queries:$luceneVersion" diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 6e8a15b9205e..a199ea295029 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -163,7 +163,7 @@ /** * In case the version is updated, please also increment {@link org.jabref.model.search.SearchFieldConstants#VERSION} to trigger reindexing. */ - uses org.apache.lucene.codecs.lucene912.Lucene912Codec; + uses org.apache.lucene.codecs.lucene100.Lucene100Codec; requires org.apache.lucene.analysis.common; requires org.apache.lucene.core; requires org.apache.lucene.highlighter; diff --git a/src/main/java/org/jabref/logic/search/retrieval/LuceneSearcher.java b/src/main/java/org/jabref/logic/search/retrieval/LuceneSearcher.java index 944cfad66ce9..5abd93ea5382 100644 --- a/src/main/java/org/jabref/logic/search/retrieval/LuceneSearcher.java +++ b/src/main/java/org/jabref/logic/search/retrieval/LuceneSearcher.java @@ -111,7 +111,7 @@ private SearchResults searchInBibFields(Query searchQuery) throws IOException { private SearchResults search(IndexSearcher indexSearcher, Query searchQuery, boolean shouldSearchInLinkedFiles) throws IOException { TopDocs topDocs = indexSearcher.search(searchQuery, Integer.MAX_VALUE); StoredFields storedFields = indexSearcher.storedFields(); - LOGGER.debug("Found {} matching documents", topDocs.totalHits.value); + LOGGER.debug("Found {} matching documents", topDocs.totalHits.value()); return getSearchResults(topDocs, storedFields, searchQuery, shouldSearchInLinkedFiles); } diff --git a/src/main/java/org/jabref/model/search/SearchFieldConstants.java b/src/main/java/org/jabref/model/search/SearchFieldConstants.java index 55ca66ac5cf5..c8d4242d9712 100644 --- a/src/main/java/org/jabref/model/search/SearchFieldConstants.java +++ b/src/main/java/org/jabref/model/search/SearchFieldConstants.java @@ -16,7 +16,7 @@ public enum SearchFieldConstants { * 2. Lucene codec changes (see module-info.java Lucene section) * Incrementing triggers reindexing. */ - VERSION("2"), + VERSION("3"), DEFAULT_FIELD("any"), ENTRY_ID("id"), ENTRY_TYPE("entrytype"), From 9bab910a718a5eaf11a4e8bd64c0bafa9d746e4d Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 14 Oct 2024 21:53:29 +0200 Subject: [PATCH 13/50] Add assign-me-action (#11945) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add assign-me-action * Fix linting issues. * Fix grammar * Add reaction on 📍 Assigned --- .github/workflows/assign-issue.yml | 34 +++++++++++++++++++++ .github/workflows/react-on-issue-labels.yml | 23 ++++++++++++++ CONTRIBUTING.md | 17 +++++++++-- 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/assign-issue.yml diff --git a/.github/workflows/assign-issue.yml b/.github/workflows/assign-issue.yml new file mode 100644 index 000000000000..70c897757422 --- /dev/null +++ b/.github/workflows/assign-issue.yml @@ -0,0 +1,34 @@ +name: Assign Issue + +on: + schedule: + - cron: 0 0 * * * + issue_comment: + types: [created] + workflow_dispatch: + +jobs: + assign: + runs-on: ubuntu-latest + steps: + - name: Assign the user or unassign stale assignments + uses: takanome-dev/assign-issue-action@v2.1.1 + with: + github_token: '${{ secrets.GITHUB_TOKEN }}' + days_until_unassign: 30 + assigned_comment: | + 👋 Hey @{{ comment.user.login }}, + + Thanks for your interest in this issue! 🎉 + + Newcomers, we're excited to have you on board. Start by exploring our [Contributing](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md) guidelines, and don't forget to check out our [workspace setup guidelines](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace) to get started smoothly. + + In case you encounter failing tests during development, please check our [developer FAQs](https://devdocs.jabref.org/code-howtos/faq.html)! + + Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on [JabRef's Gitter chat](https://gitter.im/JabRef/jabref). And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback. + + ⚠ Note that this issue will become unassigned if it isn't closed within **{{ totalDays }} days**. + + 🔧 A maintainer can also add the **{{ inputs.pin_label }}** label to prevent it from being unassigned automatically. + + Happy coding! 🚀 diff --git a/.github/workflows/react-on-issue-labels.yml b/.github/workflows/react-on-issue-labels.yml index b7ada31e9538..552a120b696e 100644 --- a/.github/workflows/react-on-issue-labels.yml +++ b/.github/workflows/react-on-issue-labels.yml @@ -46,3 +46,26 @@ jobs: target-labels: "FirstTimeCodeContribution" target-column: "Assigned" ignored-columns: "" + Assigned: + name: "Update project boards for label '📍 Assigned'" + if: ${{ github.event.label.name == '📍 Assigned' }} + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Move Issue to "Assigned" Column in "Candidates for University Projects" + uses: m7kvqbe1/github-action-move-issues@v1.0.0 + with: + github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }} + project-url: "https://github.com/orgs/JabRef/projects/3" + target-labels: "📍 Assigned" + target-column: "Assigned" + ignored-columns: "" + - name: Move Issue to "Assigned" Column in "Good First Issues" + uses: m7kvqbe1/github-action-move-issues@v1.0.0 + with: + github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }} + project-url: "https://github.com/orgs/JabRef/projects/5" + target-labels: "📍 Assigned" + target-column: "Assigned" + ignored-columns: "" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8077df7f631a..f1f647d438ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,14 @@ If you are not familiar with this type of workflow, take a look at GitHub's exce Before you start, get the JabRef code on your local machine. Detailed instructions about this step can be found in our [guidelines for setting up a local workspace](getting-into-the-code/guidelines-for-setting-up-a-local-workspace/). +## Table of Contents + +* [Choosing a task](#choosing-a-task-) +* [Getting a task assigned](#getting-a-task-assigned) +* [Pull Request Process](#pull-request-process) + * [Requirements on the pull request and code](#requirements-on-the-pull-request-and-code) + * [Development hints](#development-hints) + ## Choosing a task [![Join the chat at https://gitter.im/JabRef/jabref](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/JabRef/jabref) In general, we offer small issues perfect for aspiring developers. @@ -22,7 +30,7 @@ We collect good issues to start with at our [list of good first issues](https:// ### I am a student and I want to choose from a curated list of university projects -Have a look at [JabRefs candidates for university projects](https://github.com/orgs/JabRef/projects/3). There, a list of possible projects to work on during a teaching period is offered. +Take a look at [JabRef's candidates for university projects](https://github.com/orgs/JabRef/projects/3). There, a list of possible projects to work on during a teaching period is offered. ### I am a lecturer @@ -35,7 +43,7 @@ Look at the discussions in our forum about [new features](https://discourse.jabr Find an interesting topic, discuss it and start contributing. Alternatively, you can check out [JabRef's projects page at GitHub](https://github.com/JabRef/jabref/projects?query=is%3Aopen). Although, of course, you can choose to work on ANY issue, choosing from the projects page has the advantage that these issues have already been categorized, sorted and screened by JabRef maintainers. -A typical sub classifications scheme is "priority" (high, normal and low). Fixing high priority issues is preferred. +A typical subclassifications scheme is "priority" (high, normal and low). Fixing high priority issues is preferred. ### I want to know how to contribute code and set up my workspace @@ -48,6 +56,11 @@ GitHub offers a good guide at [Editing files in another user's repository](https One can also add [callouts](https://just-the-docs.github.io/just-the-docs-tests/components/callouts/). +## Getting a task assigned + +Comment on the issue you want to work at with `/assign-me`. +GitHub will then automatically assign you. + ## Pull Request Process 1. **Create a new branch** (such as `fix-for-issue-121`). Be sure to create a **separate branch** for each improvement you implement. From 9e0343fcdb048dcc5372f530ad4905aa506a13e7 Mon Sep 17 00:00:00 2001 From: Subhramit Basu Bhowmick Date: Tue, 15 Oct 2024 02:01:39 +0530 Subject: [PATCH 14/50] Establish guidelines for usage of AI in PRs (#11940) * Add check for AI-generated PRs * Refine * Add to greeting * Remove reference to code of conduct * Change mandatory check * Refine condition Co-authored-by: Ruslan Co-authored-by: Subhramit Basu Bhowmick <74734844+subhramit@users.noreply.github.com> Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com> * Discard changes to .github/workflows/add-greeting-to-issue.yml * Update CONTRIBUTING.md Co-authored-by: Ruslan Co-authored-by: Subhramit Basu Bhowmick <74734844+subhramit@users.noreply.github.com> Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com> * Update PULL_REQUEST_TEMPLATE.md Co-authored-by: Ruslan Co-authored-by: Subhramit Basu Bhowmick <74734844+subhramit@users.noreply.github.com> Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com> --------- Co-authored-by: Oliver Kopp Co-authored-by: Ruslan Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com> --- .github/PULL_REQUEST_TEMPLATE.md | 1 + CONTRIBUTING.md | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 16199f2abf73..fc055df043fc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -13,6 +13,7 @@ Don't reference an issue in the PR title because GitHub does not support auto-li - [x] done; [ ] not done / not applicable --> +- [x] I own the copyright of the code submitted and I licence it under the [MIT license](https://github.com/JabRef/jabref/blob/main/LICENSE) - [ ] Change in `CHANGELOG.md` described in a way that is understandable for the average user (if applicable) - [ ] Tests created for changes (if applicable) - [ ] Manually tested changed features in running JabRef (always required) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f1f647d438ee..90f735fa4a30 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,6 +113,17 @@ We also show all contributors in our blog posts. See [Release 5.15 blog post](ht Your contribution is considered being made under [MIT license](https://tldrlegal.com/license/mit-license). +#### Notes on AI usage + +Please keep these two principles in mind when you contribute: + +1. Never let an LLM speak for you. +2. Never let an LLM think for you. + +More reading on that is available at . + +We reserve the right to reject pull requests that contain little or no genuine and original contribution from the contributor. + ### Development hints #### When adding an external dependency From 2aa300a87d925420d7590bb206083b889904087f Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:47:12 +0200 Subject: [PATCH 15/50] Replace new instantiation of BuildInfo with calls to Injector (#11954) * Replace new instantiation of BuildInfo with calls to Injector * Extract call to default keys out of fetchers * Inject buildInfo * Integrate SemanticScholarFetcher * Integrate IEEE * Add warning log * Adapt devdocs * Integrate SpringerLink * Add comment * Enhance doc * Enhance doc --- docs/code-howtos/fetchers.md | 10 ++++++-- src/main/java/org/jabref/Launcher.java | 4 +++- .../SemanticScholarFetcher.java | 22 +++++------------ .../logic/importer/ImporterPreferences.java | 11 ++++++++- .../fetcher/AstrophysicsDataSystem.java | 9 ++++--- .../importer/fetcher/BiodiversityLibrary.java | 7 ++---- .../jabref/logic/importer/fetcher/IEEE.java | 8 +------ .../logic/importer/fetcher/ScienceDirect.java | 7 +++--- .../importer/fetcher/SpringerFetcher.java | 5 +--- .../logic/importer/fetcher/SpringerLink.java | 4 +--- .../preferences/JabRefCliPreferences.java | 24 +++++++++++++++++++ .../java/org/jabref/logic/util/BuildInfo.java | 2 -- .../org/jabref/logic/util/Directories.java | 4 ++-- .../fetcher/BiodiversityLibraryTest.java | 13 +++++----- .../org/jabref/logic/util/BuildInfoTest.java | 7 ------ 15 files changed, 71 insertions(+), 66 deletions(-) diff --git a/docs/code-howtos/fetchers.md b/docs/code-howtos/fetchers.md index b9520cb56be2..e10c800b9400 100644 --- a/docs/code-howtos/fetchers.md +++ b/docs/code-howtos/fetchers.md @@ -76,10 +76,16 @@ In `build.gradle`, these variables are filled: "springerNatureAPIKey" : System.getenv('SpringerNatureAPIKey') ``` -The `BuildInfo` class reads from that file. +The `BuildInfo` class reads from that file and the key needs to be put into the map of default API keys in `JabRefCliPreferences::getDefaultFetcherKeys`. ```java -new BuildInfo().springerNatureAPIKey +keys.put(SpringerFetcher.FETCHER_NAME, buildInfo.springerNatureAPIKey); +``` + +The fetcher api key can then be obtained by calling the preferences. + +```java +importerPreferences.getApiKey(SpringerFetcher.FETCHER_NAME); ``` When executing `./gradlew run`, gradle executes `processResources` and populates `build/build.properties` accordingly. However, when working directly in the IDE, Eclipse keeps reading `build.properties` from `src/main/resources`. In IntelliJ, the task `JabRef Main` is executing `./gradlew processResources` before running JabRef from the IDE to ensure the `build.properties` is properly populated. diff --git a/src/main/java/org/jabref/Launcher.java b/src/main/java/org/jabref/Launcher.java index 947c2f3dd343..e9119bc3315b 100644 --- a/src/main/java/org/jabref/Launcher.java +++ b/src/main/java/org/jabref/Launcher.java @@ -33,6 +33,7 @@ import org.jabref.logic.util.BuildInfo; import org.jabref.logic.util.Directories; import org.jabref.logic.util.HeadlessExecutorService; +import org.jabref.logic.util.Version; import org.jabref.migrations.PreferencesMigrations; import org.jabref.model.entry.BibEntryTypesManager; import org.jabref.model.util.DirectoryMonitor; @@ -140,7 +141,8 @@ private static void initLogging(String[] args) { } // addLogToDisk - Path directory = Directories.getLogDirectory(); + Version version = Injector.instantiateModelOrService(BuildInfo.class).version; + Path directory = Directories.getLogDirectory(version); try { Files.createDirectories(directory); } catch (IOException e) { diff --git a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/semanticscholar/SemanticScholarFetcher.java b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/semanticscholar/SemanticScholarFetcher.java index 557a135741e0..a183f7082e4d 100644 --- a/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/semanticscholar/SemanticScholarFetcher.java +++ b/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/semanticscholar/SemanticScholarFetcher.java @@ -9,15 +9,14 @@ import org.jabref.logic.importer.ImporterPreferences; import org.jabref.logic.importer.fetcher.CustomizableKeyFetcher; import org.jabref.logic.net.URLDownload; -import org.jabref.logic.util.BuildInfo; import org.jabref.model.entry.BibEntry; import com.google.gson.Gson; public class SemanticScholarFetcher implements CitationFetcher, CustomizableKeyFetcher { - private static final String SEMANTIC_SCHOLAR_API = "https://api.semanticscholar.org/graph/v1/"; + public static final String FETCHER_NAME = "Semantic Scholar Citations Fetcher"; - private static final String API_KEY = new BuildInfo().semanticScholarApiKey; + private static final String SEMANTIC_SCHOLAR_API = "https://api.semanticscholar.org/graph/v1/"; private final ImporterPreferences importerPreferences; @@ -45,10 +44,8 @@ public List searchCitedBy(BibEntry entry) throws FetcherException { } URLDownload urlDownload = new URLDownload(citationsUrl); - String apiKey = getApiKey(); - if (!apiKey.isEmpty()) { - urlDownload.addHeader("x-api-key", apiKey); - } + importerPreferences.getApiKey(getName()).ifPresent(apiKey -> urlDownload.addHeader("x-api-key", apiKey)); + CitationsResponse citationsResponse = new Gson() .fromJson(urlDownload.asString(), CitationsResponse.class); @@ -71,10 +68,7 @@ public List searchCiting(BibEntry entry) throws FetcherException { } URLDownload urlDownload = new URLDownload(referencesUrl); - String apiKey = getApiKey(); - if (!apiKey.isEmpty()) { - urlDownload.addHeader("x-api-key", apiKey); - } + importerPreferences.getApiKey(getName()).ifPresent(apiKey -> urlDownload.addHeader("x-api-key", apiKey)); ReferencesResponse referencesResponse = new Gson() .fromJson(urlDownload.asString(), ReferencesResponse.class); @@ -86,10 +80,6 @@ public List searchCiting(BibEntry entry) throws FetcherException { @Override public String getName() { - return "Semantic Scholar Citations Fetcher"; - } - - private String getApiKey() { - return importerPreferences.getApiKey(getName()).orElse(API_KEY); + return FETCHER_NAME; } } diff --git a/src/main/java/org/jabref/logic/importer/ImporterPreferences.java b/src/main/java/org/jabref/logic/importer/ImporterPreferences.java index ebb95bfb4a9f..64df8d2c9bc0 100644 --- a/src/main/java/org/jabref/logic/importer/ImporterPreferences.java +++ b/src/main/java/org/jabref/logic/importer/ImporterPreferences.java @@ -2,6 +2,7 @@ import java.nio.file.Path; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.Set; @@ -23,6 +24,7 @@ public class ImporterPreferences { private final BooleanProperty warnAboutDuplicatesOnImport; private final ObjectProperty importWorkingDirectory; private final ObservableSet apiKeys; + private final Map defaultApiKeys; private final ObservableSet customImporters; private final BooleanProperty persistCustomKeys; private final ObservableList catalogs; @@ -34,6 +36,7 @@ public ImporterPreferences(boolean importerEnabled, boolean warnAboutDuplicatesOnImport, Set customImporters, Set apiKeys, + Map defaultApiKeys, boolean persistCustomKeys, List catalogs, PlainCitationParserChoice defaultPlainCitationParser @@ -44,6 +47,7 @@ public ImporterPreferences(boolean importerEnabled, this.warnAboutDuplicatesOnImport = new SimpleBooleanProperty(warnAboutDuplicatesOnImport); this.customImporters = FXCollections.observableSet(customImporters); this.apiKeys = FXCollections.observableSet(apiKeys); + this.defaultApiKeys = defaultApiKeys; this.persistCustomKeys = new SimpleBooleanProperty(persistCustomKeys); this.catalogs = FXCollections.observableArrayList(catalogs); this.defaultPlainCitationParser = new SimpleObjectProperty<>(defaultPlainCitationParser); @@ -122,12 +126,17 @@ public void setPersistCustomKeys(boolean persistCustomKeys) { this.persistCustomKeys.set(persistCustomKeys); } + /** + * @param name of the fetcher + * @return either a customized API key if configured or the default key + */ public Optional getApiKey(String name) { return apiKeys.stream() .filter(key -> key.getName().equalsIgnoreCase(name)) .filter(FetcherApiKey::shouldUse) .findFirst() - .map(FetcherApiKey::getKey); + .map(FetcherApiKey::getKey) + .or(() -> Optional.ofNullable(defaultApiKeys.get(name))); } public void setCatalogs(List catalogs) { diff --git a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java index 373cd0644275..df90f2b076ed 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java @@ -30,7 +30,6 @@ import org.jabref.logic.importer.fetcher.transformers.DefaultQueryTransformer; import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.logic.net.URLDownload; -import org.jabref.logic.util.BuildInfo; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; @@ -48,11 +47,11 @@ */ public class AstrophysicsDataSystem implements IdBasedParserFetcher, PagedSearchBasedParserFetcher, EntryBasedParserFetcher, CustomizableKeyFetcher { + public static final String FETCHER_NAME = "SAO/NASA ADS"; private static final String API_SEARCH_URL = "https://api.adsabs.harvard.edu/v1/search/query"; private static final String API_EXPORT_URL = "https://api.adsabs.harvard.edu/v1/export/bibtexabs"; - private static final String API_KEY = new BuildInfo().astrophysicsDataSystemAPIKey; private final ImportFormatPreferences preferences; private final ImporterPreferences importerPreferences; @@ -79,7 +78,7 @@ private static URL getURLforExport() throws URISyntaxException, MalformedURLExce @Override public String getName() { - return "SAO/NASA ADS"; + return FETCHER_NAME; } /** @@ -255,7 +254,7 @@ private List performSearchByIds(Collection identifiers) throws try { String postData = buildPostData(ids); URLDownload download = new URLDownload(urLforExport); - download.addHeader("Authorization", "Bearer " + importerPreferences.getApiKey(getName()).orElse(API_KEY)); + importerPreferences.getApiKey(getName()).ifPresent(key -> download.addHeader("Authorization", "Bearer " + key)); download.addHeader("ContentType", "application/json"); download.setPostData(postData); String content = download.asString(); @@ -308,7 +307,7 @@ public Page performSearchPaged(QueryNode luceneQuery, int pageNumber) @Override public URLDownload getUrlDownload(URL url) { URLDownload urlDownload = new URLDownload(url); - urlDownload.addHeader("Authorization", "Bearer " + importerPreferences.getApiKey(getName()).orElse(API_KEY)); + importerPreferences.getApiKey(getName()).ifPresent(key -> urlDownload.addHeader("Authorization", "Bearer " + key)); return urlDownload; } } diff --git a/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java b/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java index 99ce61c4ca94..f5154d60b236 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java @@ -16,7 +16,6 @@ import org.jabref.logic.importer.fetcher.transformers.BiodiversityLibraryTransformer; import org.jabref.logic.importer.util.JsonReader; import org.jabref.logic.net.URLDownload; -import org.jabref.logic.util.BuildInfo; import org.jabref.model.entry.Author; import org.jabref.model.entry.AuthorList; import org.jabref.model.entry.BibEntry; @@ -37,14 +36,12 @@ * @see API documentation */ public class BiodiversityLibrary implements SearchBasedParserFetcher, CustomizableKeyFetcher { + public static final String FETCHER_NAME = "Biodiversity Heritage"; - private static final String API_KEY = new BuildInfo().biodiversityHeritageApiKey; private static final String BASE_URL = "https://www.biodiversitylibrary.org/api3"; private static final String RESPONSE_FORMAT = "json"; private static final String TEST_URL_WITHOUT_API_KEY = "https://www.biodiversitylibrary.org/api3?apikey="; - private static final String FETCHER_NAME = "Biodiversity Heritage"; - private final ImporterPreferences importerPreferences; public BiodiversityLibrary(ImporterPreferences importerPreferences) { @@ -63,7 +60,7 @@ public String getTestUrl() { public URL getBaseURL() throws URISyntaxException, MalformedURLException { URIBuilder baseURI = new URIBuilder(BASE_URL); - baseURI.addParameter("apikey", importerPreferences.getApiKey(getName()).orElse(API_KEY)); + importerPreferences.getApiKey(getName()).ifPresent(key -> baseURI.addParameter("apikey", key)); baseURI.addParameter("format", RESPONSE_FORMAT); return baseURI.build().toURL(); diff --git a/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java b/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java index 6d1f93e9b65b..fc09fd9fd4d1 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java @@ -24,7 +24,6 @@ import org.jabref.logic.importer.fetcher.transformers.IEEEQueryTransformer; import org.jabref.logic.net.URLDownload; import org.jabref.logic.os.OS; -import org.jabref.logic.util.BuildInfo; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.StandardField; @@ -59,7 +58,6 @@ public class IEEE implements FulltextFetcher, PagedSearchBasedParserFetcher, Cus private static final Pattern PDF_PATTERN = Pattern.compile("\"(https://ieeexplore.ieee.org/ielx[0-9/]+\\.pdf[^\"]+)\""); private static final String IEEE_DOI = "10.1109"; private static final String BASE_URL = "https://ieeexplore.ieee.org"; - private static final String API_KEY = new BuildInfo().ieeeAPIKey; private static final String TEST_URL_WITHOUT_API_KEY = "https://ieeexploreapi.ieee.org/api/v1/search/articles?max_records=0&apikey="; private final ImportFormatPreferences importFormatPreferences; @@ -264,10 +262,6 @@ public Optional getHelpPage() { return Optional.of(HelpFile.FETCHER_IEEEXPLORE); } - private String getApiKey() { - return importerPreferences.getApiKey(getName()).orElse(API_KEY); - } - @Override public String getTestUrl() { return TEST_URL_WITHOUT_API_KEY; @@ -280,7 +274,7 @@ public URL getURLForQuery(QueryNode luceneQuery, int pageNumber) throws URISynta transformer = new IEEEQueryTransformer(); String transformedQuery = transformer.transformLuceneQuery(luceneQuery).orElse(""); URIBuilder uriBuilder = new URIBuilder("https://ieeexploreapi.ieee.org/api/v1/search/articles"); - uriBuilder.addParameter("apikey", getApiKey()); + importerPreferences.getApiKey(FETCHER_NAME).ifPresent(apiKey -> uriBuilder.addParameter("apikey", apiKey)); if (!transformedQuery.isBlank()) { uriBuilder.addParameter("querytext", transformedQuery); } diff --git a/src/main/java/org/jabref/logic/importer/fetcher/ScienceDirect.java b/src/main/java/org/jabref/logic/importer/fetcher/ScienceDirect.java index cb7498e43888..cf64ae0f92ef 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/ScienceDirect.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/ScienceDirect.java @@ -11,7 +11,6 @@ import org.jabref.logic.importer.FulltextFetcher; import org.jabref.logic.importer.ImporterPreferences; import org.jabref.logic.net.URLDownload; -import org.jabref.logic.util.BuildInfo; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.identifier.DOI; @@ -35,11 +34,11 @@ * See https://dev.elsevier.com/. */ public class ScienceDirect implements FulltextFetcher, CustomizableKeyFetcher { + public static final String FETCHER_NAME = "ScienceDirect"; + private static final Logger LOGGER = LoggerFactory.getLogger(ScienceDirect.class); private static final String API_URL = "https://api.elsevier.com/content/article/doi/"; - private static final String API_KEY = new BuildInfo().scienceDirectApiKey; - private static final String FETCHER_NAME = "ScienceDirect"; private final ImporterPreferences importerPreferences; @@ -140,7 +139,7 @@ private String getUrlByDoi(String doi) throws UnirestException { try { String request = API_URL + doi; HttpResponse jsonResponse = Unirest.get(request) - .header("X-ELS-APIKey", importerPreferences.getApiKey(getName()).orElse(API_KEY)) + .header("X-ELS-APIKey", importerPreferences.getApiKey(getName()).orElse("")) .queryString("httpAccept", "application/json") .asJson(); diff --git a/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java index 895fa66d0989..aa21089d2535 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java @@ -17,7 +17,6 @@ import org.jabref.logic.importer.Parser; import org.jabref.logic.importer.fetcher.transformers.SpringerQueryTransformer; import org.jabref.logic.os.OS; -import org.jabref.logic.util.BuildInfo; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.Month; @@ -39,13 +38,11 @@ * @see API documentation for more details */ public class SpringerFetcher implements PagedSearchBasedParserFetcher, CustomizableKeyFetcher { - public static final String FETCHER_NAME = "Springer"; private static final Logger LOGGER = LoggerFactory.getLogger(SpringerFetcher.class); private static final String API_URL = "https://api.springernature.com/meta/v1/json"; - private static final String API_KEY = new BuildInfo().springerNatureAPIKey; // Springer query using the parameter 'q=doi:10.1007/s11276-008-0131-4s=1' will respond faster private static final String TEST_URL_WITHOUT_API_KEY = "https://api.springernature.com/meta/v1/json?q=doi:10.1007/s11276-008-0131-4s=1&p=1&api_key="; @@ -188,7 +185,7 @@ public String getTestUrl() { public URL getURLForQuery(QueryNode luceneQuery, int pageNumber) throws URISyntaxException, MalformedURLException { URIBuilder uriBuilder = new URIBuilder(API_URL); uriBuilder.addParameter("q", new SpringerQueryTransformer().transformLuceneQuery(luceneQuery).orElse("")); // Search query - uriBuilder.addParameter("api_key", importerPreferences.getApiKey(getName()).orElse(API_KEY)); // API key + importerPreferences.getApiKey(getName()).ifPresent(key -> uriBuilder.addParameter("api_key", key)); // API key uriBuilder.addParameter("s", String.valueOf(getPageSize() * pageNumber + 1)); // Start entry, starts indexing at 1 uriBuilder.addParameter("p", String.valueOf(getPageSize())); // Page size return uriBuilder.build().toURL(); diff --git a/src/main/java/org/jabref/logic/importer/fetcher/SpringerLink.java b/src/main/java/org/jabref/logic/importer/fetcher/SpringerLink.java index 7a8551fb451a..25a23c7b7ae2 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/SpringerLink.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/SpringerLink.java @@ -9,7 +9,6 @@ import org.jabref.logic.importer.FulltextFetcher; import org.jabref.logic.importer.ImporterPreferences; -import org.jabref.logic.util.BuildInfo; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.identifier.DOI; @@ -33,7 +32,6 @@ public class SpringerLink implements FulltextFetcher, CustomizableKeyFetcher { private static final Logger LOGGER = LoggerFactory.getLogger(SpringerLink.class); private static final String API_URL = "https://api.springer.com/meta/v1/json"; - private static final String API_KEY = new BuildInfo().springerNatureAPIKey; private static final String CONTENT_HOST = "link.springer.com"; private final ImporterPreferences importerPreferences; @@ -55,7 +53,7 @@ public Optional findFullText(BibEntry entry) throws IOException { // Available in catalog? try { HttpResponse jsonResponse = Unirest.get(API_URL) - .queryString("api_key", importerPreferences.getApiKey(getName()).orElse(API_KEY)) + .queryString("api_key", importerPreferences.getApiKey(getName()).orElse("")) .queryString("q", "doi:%s".formatted(doi.get().getDOI())) .asJson(); if (jsonResponse.getBody() != null) { diff --git a/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java b/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java index a15d1014c87f..79492a8f72c5 100644 --- a/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java +++ b/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java @@ -31,6 +31,7 @@ import javafx.collections.ListChangeListener; import javafx.collections.SetChangeListener; +import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.SemanticScholarFetcher; import org.jabref.logic.FilePreferences; import org.jabref.logic.InternalPreferences; import org.jabref.logic.JabRefException; @@ -52,9 +53,12 @@ import org.jabref.logic.importer.ImportFormatPreferences; import org.jabref.logic.importer.ImporterPreferences; import org.jabref.logic.importer.fetcher.ACMPortalFetcher; +import org.jabref.logic.importer.fetcher.AstrophysicsDataSystem; +import org.jabref.logic.importer.fetcher.BiodiversityLibrary; import org.jabref.logic.importer.fetcher.DBLPFetcher; import org.jabref.logic.importer.fetcher.IEEE; import org.jabref.logic.importer.fetcher.MrDlibPreferences; +import org.jabref.logic.importer.fetcher.ScienceDirect; import org.jabref.logic.importer.fetcher.SpringerFetcher; import org.jabref.logic.importer.fileformat.CustomImporter; import org.jabref.logic.importer.plaincitation.PlainCitationParserChoice; @@ -81,6 +85,7 @@ import org.jabref.logic.search.SearchPreferences; import org.jabref.logic.shared.prefs.SharedDatabasePreferences; import org.jabref.logic.shared.security.Password; +import org.jabref.logic.util.BuildInfo; import org.jabref.logic.util.Directories; import org.jabref.logic.util.Version; import org.jabref.logic.util.io.AutoLinkPreferences; @@ -1998,6 +2003,7 @@ public ImporterPreferences getImporterPreferences() { getBoolean(WARN_ABOUT_DUPLICATES_IN_INSPECTION), getCustomImportFormats(), getFetcherKeys(), + getDefaultFetcherKeys(), getBoolean(FETCHER_CUSTOM_KEY_PERSIST), getStringList(SEARCH_CATALOGS), PlainCitationParserChoice.valueOf(get(DEFAULT_PLAIN_CITATION_PARSER)) @@ -2085,6 +2091,24 @@ private List getFetcherKeysFromKeyring(List names) { return keys; } + private Map getDefaultFetcherKeys() { + BuildInfo buildInfo = Injector.instantiateModelOrService(BuildInfo.class); + if (buildInfo == null) { + LOGGER.warn("Could not instantiate BuildInfo."); + return Collections.emptyMap(); + } + + Map keys = new HashMap<>(); + keys.put(SemanticScholarFetcher.FETCHER_NAME, buildInfo.semanticScholarApiKey); + keys.put(AstrophysicsDataSystem.FETCHER_NAME, buildInfo.astrophysicsDataSystemAPIKey); + keys.put(BiodiversityLibrary.FETCHER_NAME, buildInfo.biodiversityHeritageApiKey); + keys.put(ScienceDirect.FETCHER_NAME, buildInfo.scienceDirectApiKey); + keys.put(SpringerFetcher.FETCHER_NAME, buildInfo.springerNatureAPIKey); + // SpringerLink uses the same key and fetcher name as SpringerFetcher + + return keys; + } + private void storeFetcherKeys(Set fetcherApiKeys) { List names = new ArrayList<>(); List uses = new ArrayList<>(); diff --git a/src/main/java/org/jabref/logic/util/BuildInfo.java b/src/main/java/org/jabref/logic/util/BuildInfo.java index 352d4531a4ac..755594ee88c2 100644 --- a/src/main/java/org/jabref/logic/util/BuildInfo.java +++ b/src/main/java/org/jabref/logic/util/BuildInfo.java @@ -20,7 +20,6 @@ public final class BuildInfo { public final Version version; public final String maintainers; public final String year; - public final String azureInstrumentationKey; public final String springerNatureAPIKey; public final String astrophysicsDataSystemAPIKey; public final String ieeeAPIKey; @@ -50,7 +49,6 @@ public BuildInfo(String path) { version = Version.parse(properties.getProperty("version")); year = properties.getProperty("year", ""); maintainers = properties.getProperty("maintainers", ""); - azureInstrumentationKey = BuildInfo.getValue(properties, "azureInstrumentationKey", ""); springerNatureAPIKey = BuildInfo.getValue(properties, "springerNatureAPIKey", "118d90a519d0fc2a01ee9715400054d4"); astrophysicsDataSystemAPIKey = BuildInfo.getValue(properties, "astrophysicsDataSystemAPIKey", "tAhPRKADc6cC26mZUnAoBt3MAjCvKbuCZsB4lI3c"); ieeeAPIKey = BuildInfo.getValue(properties, "ieeeAPIKey", "5jv3wyt4tt2bwcwv7jjk7pc3"); diff --git a/src/main/java/org/jabref/logic/util/Directories.java b/src/main/java/org/jabref/logic/util/Directories.java index 00396975da7e..5be00b548d30 100644 --- a/src/main/java/org/jabref/logic/util/Directories.java +++ b/src/main/java/org/jabref/logic/util/Directories.java @@ -25,13 +25,13 @@ public static Path getUserDirectory() { return Path.of(System.getProperty("user.home")); } - public static Path getLogDirectory() { + public static Path getLogDirectory(Version version) { return Path.of(AppDirsFactory.getInstance() .getUserDataDir( OS.APP_DIR_APP_NAME, "logs", OS.APP_DIR_APP_AUTHOR)) - .resolve(new BuildInfo().version.toString()); + .resolve(version.toString()); } public static Path getBackupDirectory() { diff --git a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java index 1df6e6ed6155..a42d50a8772a 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java @@ -27,14 +27,14 @@ @FetcherTest class BiodiversityLibraryTest { - private final String BASE_URL = "https://www.biodiversitylibrary.org/api3?"; private final String RESPONSE_FORMAT = "&format=json"; - private final BuildInfo buildInfo = new BuildInfo(); + private String apiKey; private BiodiversityLibrary fetcher; @BeforeEach void setUp() { + apiKey = new BuildInfo().biodiversityHeritageApiKey; ImporterPreferences importerPreferences = mock(ImporterPreferences.class); when(importerPreferences.getApiKeys()).thenReturn(FXCollections.emptyObservableSet()); fetcher = new BiodiversityLibrary(importerPreferences); @@ -49,15 +49,14 @@ void getName() { @Test void biodiversityHeritageApiKeyIsNotEmpty() { - BuildInfo buildInfo = new BuildInfo(); - assertNotNull(buildInfo.biodiversityHeritageApiKey); + assertNotNull(apiKey); } @Test void baseURLConstruction() throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() - .concat(buildInfo.biodiversityHeritageApiKey) + .concat(apiKey) .concat(RESPONSE_FORMAT); assertEquals(expected, fetcher.getBaseURL().toString()); @@ -68,7 +67,7 @@ void baseURLConstruction() throws MalformedURLException, URISyntaxException { void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() - .concat(buildInfo.biodiversityHeritageApiKey) + .concat(apiKey) .concat(RESPONSE_FORMAT) .concat("&op=GetPartMetadata&pages=f&names=f") .concat("&id="); @@ -81,7 +80,7 @@ void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxExceptio void getItemMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() - .concat(buildInfo.biodiversityHeritageApiKey) + .concat(apiKey) .concat(RESPONSE_FORMAT) .concat("&op=GetItemMetadata&pages=f&ocr=f&ocr=f") .concat("&id="); diff --git a/src/test/java/org/jabref/logic/util/BuildInfoTest.java b/src/test/java/org/jabref/logic/util/BuildInfoTest.java index ceabe9e2657e..2008e912a89d 100644 --- a/src/test/java/org/jabref/logic/util/BuildInfoTest.java +++ b/src/test/java/org/jabref/logic/util/BuildInfoTest.java @@ -3,7 +3,6 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; class BuildInfoTest { @@ -18,10 +17,4 @@ void fileImport() { BuildInfo buildInfo = new BuildInfo("/org/jabref/util/build.properties"); assertEquals("42", buildInfo.version.getFullVersion()); } - - @Test - void azureInstrumentationKeyIsNotEmpty() { - BuildInfo buildInfo = new BuildInfo(); - assertNotNull(buildInfo.azureInstrumentationKey); - } } From 363ee2b7d0f0d3ffa1d9f1f5bea3f4c8372d05b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JasonXuDeveloper=20-=20=E5=82=91?= Date: Tue, 15 Oct 2024 07:50:26 +1100 Subject: [PATCH 16/50] added search for key binds (#11953) * added search for key binds * use the correct localization key to deal with ellipsis --------- Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> --- CHANGELOG.md | 1 + .../jabref/gui/groups/GroupDialogView.java | 2 +- .../preferences/PreferencesDialogView.java | 2 +- .../journals/JournalAbbreviationsTab.java | 15 ++------- .../keybindings/KeyBindingsTab.fxml | 32 ++++++++++++------- .../keybindings/KeyBindingsTab.java | 22 +++++++++++++ .../keybindings/KeyBindingsTabViewModel.java | 17 ++++++++-- .../gui/preferences/preview/PreviewTab.java | 2 +- .../java/org/jabref/gui/util/ColorUtil.java | 14 ++++++++ 9 files changed, 77 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73e2aad2458a..95dd140ff90e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added a different background color to the search bar to indicate when the search syntax is wrong. [#11658](https://github.com/JabRef/jabref/pull/11658) - We added a setting which always adds the literal "Cited on pages" text before each JStyle citation. [#11691](https://github.com/JabRef/jabref/pull/11732) - We added a new plain citation parser that uses LLMs. [#11825](https://github.com/JabRef/jabref/issues/11825) +- We added a search bar for filtering keyboard shortcuts. [#11686](https://github.com/JabRef/jabref/issues/11686) - By double clicking on a local citation in the Citation Relations Tab you can now jump the the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955) ### Changed diff --git a/src/main/java/org/jabref/gui/groups/GroupDialogView.java b/src/main/java/org/jabref/gui/groups/GroupDialogView.java index c1f537248ead..a355ca88fd06 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialogView.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialogView.java @@ -265,7 +265,7 @@ private void openIconPicker() { } CustomTextField searchBox = new CustomTextField(); - searchBox.setPromptText(Localization.lang("Search") + "..."); + searchBox.setPromptText(Localization.lang("Search...")); searchBox.setLeft(IconTheme.JabRefIcons.SEARCH.getGraphicNode()); searchBox.textProperty().addListener((obs, oldValue, newValue) -> filteredList.setPredicate(ikon -> newValue.isEmpty() || ikon.getDescription().toLowerCase() diff --git a/src/main/java/org/jabref/gui/preferences/PreferencesDialogView.java b/src/main/java/org/jabref/gui/preferences/PreferencesDialogView.java index bb246d0e18f8..dfebe248e696 100644 --- a/src/main/java/org/jabref/gui/preferences/PreferencesDialogView.java +++ b/src/main/java/org/jabref/gui/preferences/PreferencesDialogView.java @@ -88,7 +88,7 @@ private void initialize() { preferenceTabList.getSelectionModel().clearSelection(); preferenceTabList.getSelectionModel().selectFirst(); }); - searchBox.setPromptText(Localization.lang("Search") + "..."); + searchBox.setPromptText(Localization.lang("Search...")); searchBox.setLeft(IconTheme.JabRefIcons.SEARCH.getGraphicNode()); EasyBind.subscribe(preferenceTabList.getSelectionModel().selectedItemProperty(), tab -> { diff --git a/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java b/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java index 1ca3985fc68b..5bfa504edf59 100644 --- a/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java +++ b/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java @@ -85,7 +85,7 @@ private void initialize() { setBindings(); setAnimations(); - searchBox.setPromptText(Localization.lang("Search") + "..."); + searchBox.setPromptText(Localization.lang("Search...")); searchBox.setLeft(IconTheme.JabRefIcons.SEARCH.getGraphicNode()); } @@ -139,7 +139,7 @@ private void setBindings() { private void setAnimations() { ObjectProperty flashingColor = new SimpleObjectProperty<>(Color.TRANSPARENT); - StringProperty flashingColorStringProperty = createFlashingColorStringProperty(flashingColor); + StringProperty flashingColorStringProperty = ColorUtil.createFlashingColorStringProperty(flashingColor); searchBox.styleProperty().bind( new SimpleStringProperty("-fx-control-inner-background: ").concat(flashingColorStringProperty).concat(";") @@ -183,17 +183,6 @@ private void addAbbreviationActions() { editAbbreviation(); } - private static StringProperty createFlashingColorStringProperty(final ObjectProperty flashingColor) { - final StringProperty flashingColorStringProperty = new SimpleStringProperty(); - setColorStringFromColor(flashingColorStringProperty, flashingColor); - flashingColor.addListener((observable, oldValue, newValue) -> setColorStringFromColor(flashingColorStringProperty, flashingColor)); - return flashingColorStringProperty; - } - - private static void setColorStringFromColor(StringProperty colorStringProperty, ObjectProperty color) { - colorStringProperty.set(ColorUtil.toRGBACode(color.get())); - } - @FXML private void editAbbreviation() { journalAbbreviationsTable.edit( diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTab.fxml b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTab.fxml index e20461d98e41..7713a8fd7b9b 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTab.fxml @@ -1,5 +1,6 @@ + @@ -8,23 +9,32 @@ +