Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix-for-issue-348
Browse files Browse the repository at this point in the history
* upstream/main: (24 commits)
  Clean up test code (JabRef#10658)
  Bump org.openrewrite.rewrite from 6.4.0 to 6.5.4 (JabRef#10650)
  Bump com.puppycrawl.tools:checkstyle from 10.12.4 to 10.12.5 (JabRef#10654)
  Bump com.fasterxml.jackson.dataformat:jackson-dataformat-yaml (JabRef#10653)
  Bump com.github.Dansoftowner:jSystemThemeDetector from 3.6 to 3.8
  Remove comments - don't work on forks
  Update journal abbreviation lists (JabRef#10645)
  Use clparse (instead of heylogs) (JabRef#10641)
  Update CSL styles (JabRef#10642)
  Added parent field to Hayagriva YAML export (JabRef#10633)
  Bump org.fxmisc.richtext:richtextfx from 0.11.1 to 0.11.2 (JabRef#10637)
  Bump io.github.classgraph:classgraph from 4.8.163 to 4.8.164 (JabRef#10634)
  Bump org.junit.platform:junit-platform-launcher from 1.10.0 to 1.10.1 (JabRef#10635)
  Bump org.mockito:mockito-core from 5.6.0 to 5.7.0 (JabRef#10638)
  Bump com.tngtech.archunit:archunit-junit5-engine from 1.1.0 to 1.2.0 (JabRef#10636)
  add some more spaces
  Fix CHANGELOG.md
  Remove SearchListener
  Refactor method name to reflect usage
  Revert "Remove filtering on query in maintable"
  ...
  • Loading branch information
Siedlerchr committed Nov 21, 2023
2 parents 3d373b7 + 75107ab commit 1dfa35b
Show file tree
Hide file tree
Showing 27 changed files with 144 additions and 165 deletions.
6 changes: 0 additions & 6 deletions .github/heylogs.java

This file was deleted.

90 changes: 21 additions & 69 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,6 @@ jobs:
checkstyle_version: '10.3'
- name: Run checkstyle using gradle
run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [Checkstyle](https://checkstyle.sourceforge.io/) to identify issues.
The tool reviewdog already placed comments on GitHub to indicate the places. See the tab "Files" in you PR.
Please carefully follow [the setup guide for the codestyle](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html).
Afterwards, please run checkstyle locally and fix the issues.
More information on code quality in JabRef is available at <https://devdocs.jabref.org/getting-into-the-code/development-strategy.html>.
comment_tag: checkstyle
openrewrite:
name: OpenRewrite
runs-on: ubuntu-latest
Expand All @@ -81,19 +67,6 @@ jobs:
- name: Run OpenRewrite
run: |
./gradlew rewriteDryRun
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [OpenRewrite](https://docs.openrewrite.org/) to ensure "modern" Java coding practices.
The issues found can be **automatically fixed**.
Please execute the gradle task *`rewriteRun`*, check the results, commit, and push.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".
comment_tag: openrewrite
modernizer:
name: Modernizer
runs-on: ubuntu-latest
Expand All @@ -114,18 +87,6 @@ jobs:
# enable failing of this task if modernizer complains
sed -i "s/failOnViolations = false/failOnViolations = true/" build.gradle
./gradlew modernizer
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [Gradle Modernizer Plugin](https://github.com/andygoossens/gradle-modernizer-plugin#gradle-modernizer-plugin) to ensure "modern" Java coding practices.
Please fix the detected errors, commit, and push.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Modernizer".
comment_tag: modernizer
markdown:
name: Markdown
runs-on: ubuntu-latest
Expand All @@ -141,18 +102,7 @@ jobs:
globs: |
*.md
docs/**/*.md
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
You modified Markdown (*.md) files.
To ensure consistent styling, we have [markdown-lint](https://github.com/DavidAnson/markdownlint) in place.
[Markdown lint's rules](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#rules) help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Markdown".
comment_tag: markdown
changelog-non-frozen:
changelog:
name: CHANGELOG.md
runs-on: ubuntu-latest
steps:
Expand All @@ -161,41 +111,43 @@ jobs:
with:
submodules: 'false'
show-progress: 'false'
fetch-depth: 0
- name: Lint CHANGELOG.md
run: |
# Install jbang
curl -Ls https://sh.jbang.dev | bash -s - app setup
export PATH=$PATH:$HOME/.jbang/bin
# ensure that refs are available
BRANCH=`git rev-parse HEAD`
git checkout main
# run heylogs verification
jbang --repos jitpack,central -m nbbrd.heylogs.cli.HeylogsCommand com.github.koppor.heylogs:heylogs-cli:jitpack-SNAPSHOT check CHANGELOG.md --gitdiff main...$BRANCH > heylogs.txt || true
jbang com.github.nbbrd.heylogs:heylogs-cli:0.7.2:bin check CHANGELOG.md > heylogs.txt || true
# improve output
sed -i 's/consistent-separator/consistent-separator (ignored)/' heylogs.txt
sed -i 's/all-h2-contain-a-version/all-h2-contain-a-version (ignored)/' heylogs.txt
cat heylogs.txt
# exit 1 in case of error
# We have 1 "valid" issue in CHANGELOG.md
grep -q "1 problem" heylogs.txt || exit 1
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
changelog-unreleased-only:
name: CHANGELOG.md - only unreleased touched
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
message: >
While the PR was in progress, JabRef released a new version.
You have to merge `upstream/main` and move your entry in `CHANGELOG.md` to section `## [Unreleased]`.
It might also be that another CHANGELOG.md issue arose.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "CHANGELOG.md".
comment_tag: changelog
submodules: 'false'
show-progress: 'false'
fetch-depth: 0
- name: Install clparse
run: |
curl -LO https://github.com/marcaddeo/clparse/releases/download/0.9.1/clparse-0.9.1-x86_64-unknown-linux-musl.tar.gz
tar xzvf clparse-0.9.1-x86_64-unknown-linux-musl.tar.gz
sudo mv clparse /usr/local/bin/clparse
- name: Check CHANGELOG.md diff
run: |
diff \
<(git show origin/main:CHANGELOG.md | clparse --format=json --separator=– - | jq '.releases[] | select(.version != null)') \
<(git show HEAD:CHANGELOG.md | clparse --format=json --separator=– - | jq '.releases[] | select(.version != null)')
tests:
name: Unit tests
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list. [#10415](https://github.com/JabRef/jabref/issues/10415)
- We fixed an issue where in the merge dialog the file field of entries was not correctly merged when the first and second entry both contained values inside the file field. [#10572](https://github.com/JabRef/jabref/issues/10572)
- We fixed some small inconsistencies in the user interface. [#10507](https://github.com/JabRef/jabref/issues/10507) [#10458](https://github.com/JabRef/jabref/issues/10458)
- We fixed the issue where the Hayagriva YAML exporter would not include a parent field for the publisher/series. [#10596](https://github.com/JabRef/jabref/issues/10596)

### Removed

- We removed duplicate filtering and sorting operations in the MainTable when editing BibEntries. [#10619](https://github.com/JabRef/jabref/pull/10619)




## [5.11] – 2023-10-22

### Added
Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '6.4.0'
id 'org.openrewrite.rewrite' version '6.5.4'
}

// Enable following for debugging
Expand Down Expand Up @@ -144,7 +144,7 @@ dependencies {

implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.7.0.202309050840-r'

implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.15.3'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.16.0'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.15.3'

implementation 'com.fasterxml:aalto-xml:1.3.2'
Expand Down Expand Up @@ -173,14 +173,14 @@ dependencies {
implementation 'de.saxsys:mvvmfx:1.8.0'
implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT')
implementation 'org.fxmisc.flowless:flowless:0.7.2'
implementation 'org.fxmisc.richtext:richtextfx:0.11.1'
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.90.0') {
exclude module: 'javax.inject' // Split package, use only jakarta.inject
exclude group: 'org.apache.logging.log4j'
}

implementation 'org.controlsfx:controlsfx:11.2.0'
implementation 'com.github.Dansoftowner:jSystemThemeDetector:3.6'
implementation 'com.github.Dansoftowner:jSystemThemeDetector:3.8'

implementation 'org.jsoup:jsoup:1.16.2'
implementation 'com.konghq:unirest-java:3.14.5'
Expand Down Expand Up @@ -235,25 +235,25 @@ dependencies {
// Allow objects "magically" to be mapped to JSON using GSON
// implementation 'org.glassfish.jersey.media:jersey-media-json-gson:3.1.1'

testImplementation 'io.github.classgraph:classgraph:4.8.163'
testImplementation 'io.github.classgraph:classgraph:4.8.164'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.1'

testImplementation 'org.mockito:mockito-core:5.6.0'
testImplementation 'org.mockito:mockito-core:5.7.0'
testImplementation 'org.xmlunit:xmlunit-core:2.9.1'
testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.1.0'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.2.0'
testImplementation 'com.tngtech.archunit:archunit-junit5-api:1.2.0'
testImplementation "org.testfx:testfx-core:4.0.16-alpha"
testImplementation "org.testfx:testfx-junit5:4.0.16-alpha"
testImplementation "org.hamcrest:hamcrest-library:2.2"

checkstyle 'com.puppycrawl.tools:checkstyle:10.12.4'
checkstyle 'com.puppycrawl.tools:checkstyle:10.12.5'
// xjc needs the runtime as well for the ant task, otherwise it fails
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.4.1"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.5.0"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/src/main/groovy/org/jabref/build/xjc/XjcTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ class XjcTask extends DefaultTask {
}

private void updateOutput() {
if (outputDirectory != null && javaPackage != null)
outputs.dir(new File(getOutputDirectory(), packageAsPath(javaPackage)))
if (outputDirectory != null && javaPackage != null) {
outputs.dir(new File(getOutputDirectory(), packageAsPath(javaPackage)))
}
}

private static String packageAsPath(String pkg) {
Expand Down
5 changes: 4 additions & 1 deletion rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ recipeList:
- org.openrewrite.staticanalysis.RemoveExtraSemicolons
- org.openrewrite.staticanalysis.RemoveJavaDocAuthorTag
- org.openrewrite.staticanalysis.RemoveHashCodeCallsFromArrayInstances
- org.openrewrite.staticanalysis.RemoveRedundantTypeCast
# - org.openrewrite.staticanalysis.RemoveRedundantTypeCast
- org.openrewrite.staticanalysis.RemoveToStringCallsFromArrayInstances
- org.openrewrite.staticanalysis.RemoveUnneededAssertion
- org.openrewrite.staticanalysis.RemoveUnneededBlock
Expand Down Expand Up @@ -195,3 +195,6 @@ recipeList:
- org.openrewrite.staticanalysis.UseSystemLineSeparator
- org.openrewrite.staticanalysis.WhileInsteadOfFor
# - org.openrewrite.staticanalysis.WriteOctalValuesAsDecimal

- org.openrewrite.java.testing.junit5.CleanupAssertions
# - org.openrewrite.java.testing.junit5.JUnit5BestPractices
25 changes: 0 additions & 25 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.entry.LinkedFile;
import org.jabref.model.entry.event.EntriesEventSource;
import org.jabref.model.entry.event.EntryChangedEvent;
import org.jabref.model.entry.event.FieldChangedEvent;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
Expand Down Expand Up @@ -156,7 +155,6 @@ public LibraryTab(BibDatabaseContext bibDatabaseContext,
setupMainPanel();
setupAutoCompletion();

this.getDatabase().registerListener(new SearchListener());
this.getDatabase().registerListener(new IndexUpdateListener());
this.getDatabase().registerListener(new EntriesRemovedListener());

Expand Down Expand Up @@ -277,7 +275,6 @@ public void feedData(BibDatabaseContext bibDatabaseContextFromParserResult) {
setupMainPanel();
setupAutoCompletion();

this.getDatabase().registerListener(new SearchListener());
this.getDatabase().registerListener(new EntriesRemovedListener());

// ensure that at each addition of a new entry, the entry is added to the groups interface
Expand Down Expand Up @@ -918,28 +915,6 @@ public void listen(EntriesRemovedEvent entriesRemovedEvent) {
}
}

/**
* Ensures that the results of the current search are updated when a new entry is inserted into the database Actual methods for performing search must run in javafx thread
*/
private class SearchListener {

@Subscribe
public void listen(EntriesAddedEvent addedEntryEvent) {
DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch());
}

@Subscribe
public void listen(EntryChangedEvent entryChangedEvent) {
DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch());
}

@Subscribe
public void listen(EntriesRemovedEvent removedEntriesEvent) {
// IMO only used to update the status (found X entries)
DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch());
}
}

private class IndexUpdateListener {

@Subscribe
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public GlobalSearchBar(JabRefFrame frame, StateManager stateManager, Preferences
this.setSpacing(4.0);
this.setAlignment(Pos.CENTER_LEFT);

Timer searchTask = FxTimer.create(Duration.ofMillis(SEARCH_DELAY), this::performSearch);
Timer searchTask = FxTimer.create(Duration.ofMillis(SEARCH_DELAY), this::updateSearchQuery);
BindingsHelper.bindBidirectional(
stateManager.activeSearchQueryProperty(),
searchField.textProperty(),
Expand Down Expand Up @@ -238,31 +238,31 @@ private void initSearchModifierButtons() {
initSearchModifierButton(regularExpressionButton);
regularExpressionButton.setOnAction(event -> {
searchPreferences.setSearchFlag(SearchRules.SearchFlags.REGULAR_EXPRESSION, regularExpressionButton.isSelected());
performSearch();
updateSearchQuery();
});

caseSensitiveButton.setSelected(searchPreferences.isCaseSensitive());
caseSensitiveButton.setTooltip(new Tooltip(Localization.lang("Case sensitive")));
initSearchModifierButton(caseSensitiveButton);
caseSensitiveButton.setOnAction(event -> {
searchPreferences.setSearchFlag(SearchRules.SearchFlags.CASE_SENSITIVE, caseSensitiveButton.isSelected());
performSearch();
updateSearchQuery();
});

fulltextButton.setSelected(searchPreferences.isFulltext());
fulltextButton.setTooltip(new Tooltip(Localization.lang("Fulltext search")));
initSearchModifierButton(fulltextButton);
fulltextButton.setOnAction(event -> {
searchPreferences.setSearchFlag(SearchRules.SearchFlags.FULLTEXT, fulltextButton.isSelected());
performSearch();
updateSearchQuery();
});

keepSearchString.setSelected(searchPreferences.shouldKeepSearchString());
keepSearchString.setTooltip(new Tooltip(Localization.lang("Keep search string across libraries")));
initSearchModifierButton(keepSearchString);
keepSearchString.setOnAction(evt -> {
searchPreferences.setSearchFlag(SearchRules.SearchFlags.KEEP_SEARCH_STRING, keepSearchString.isSelected());
performSearch();
updateSearchQuery();
});

openGlobalSearchButton.disableProperty().bindBidirectional(globalSearchActive);
Expand All @@ -271,7 +271,7 @@ private void initSearchModifierButtons() {
openGlobalSearchButton.setOnAction(evt -> {
globalSearchActive.setValue(true);
globalSearchResultDialog = new GlobalSearchResultDialog(undoManager);
performSearch();
updateSearchQuery();
dialogService.showCustomDialogAndWait(globalSearchResultDialog);
globalSearchActive.setValue(false);
});
Expand All @@ -298,9 +298,9 @@ public void focus() {
searchField.selectAll();
}

public void performSearch() {
public void updateSearchQuery() {
LOGGER.debug("Flags: {}", searchPreferences.getSearchFlags());
LOGGER.debug("Run search {}", searchField.getText());
LOGGER.debug("Updated search query: {}", searchField.getText());

// An empty search field should cause the search to be cleared.
if (searchField.getText().isEmpty()) {
Expand Down
Loading

0 comments on commit 1dfa35b

Please sign in to comment.