Skip to content

Commit 2f88cc9

Browse files
authored
Merge branch 'main' into fix-for-JabRef#10935
2 parents 61062c5 + 0b0b251 commit 2f88cc9

32 files changed

+618
-79
lines changed

.github/workflows/deployment-arm64.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ jobs:
6666
submodules: 'true'
6767
show-progress: 'false'
6868
- name: Install GitVersion
69-
uses: gittools/actions/gitversion/setup@v0.11.0
69+
uses: gittools/actions/gitversion/setup@v0.13.2
7070
with:
7171
versionSpec: "5.x"
7272
- name: Run GitVersion
7373
id: gitversion
74-
uses: gittools/actions/gitversion/execute@v0.11.0
74+
uses: gittools/actions/gitversion/execute@v0.13.2
7575
- name: Setup JDK
7676
uses: actions/setup-java@v4
7777
with:

.github/workflows/deployment-jdk-ea.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,17 @@ jobs:
8282
show-progress: 'false'
8383
- name: Install pigz and cache (linux)
8484
if: (matrix.os == 'ubuntu-latest') || (matrix.os == 'buildjet-4vcpu-ubuntu-2204-arm')
85-
# 1.3.1 works, 1.4.1 does not (https://github.com/awalsh128/cache-apt-pkgs-action/issues/126)
86-
uses: koppor/cache-apt-pkgs-action@add-arm64-support
85+
uses: awalsh128/cache-apt-pkgs-action@master
8786
with:
8887
packages: pigz
8988
version: 1.0
9089
- name: Install GitVersion
91-
uses: gittools/actions/gitversion/setup@v0.11.0
90+
uses: gittools/actions/gitversion/setup@v0.13.2
9291
with:
9392
versionSpec: "5.x"
9493
- name: Run GitVersion
9594
id: gitversion
96-
uses: gittools/actions/gitversion/execute@v0.11.0
95+
uses: gittools/actions/gitversion/execute@v0.13.2
9796
- name: 'Set up JDK ${{ matrix.jdk }}'
9897
uses: oracle-actions/setup-java@v1
9998
with:

.github/workflows/deployment.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ jobs:
7979
packages: pigz
8080
version: 1.0
8181
- name: Install GitVersion
82-
uses: gittools/actions/gitversion/setup@v0.11.0
82+
uses: gittools/actions/gitversion/setup@v0.13.2
8383
with:
8484
versionSpec: "5.x"
8585
- name: Run GitVersion
8686
id: gitversion
87-
uses: gittools/actions/gitversion/execute@v0.11.0
87+
uses: gittools/actions/gitversion/execute@v0.13.2
8888
- name: Setup JDK
8989
uses: actions/setup-java@v4
9090
with:

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
1111

1212
### Added
1313

14+
- We converted the "Custom API key" list to a table to be more accessible. [#10926](https://github.com/JabRef/jabref/issues/10926)
1415
- We added a "refresh" button for the LaTeX citations tab in the entry editor. [#10584](https://github.com/JabRef/jabref/issues/10584)
1516
- We added the possibility to show the BibTeX source in the [web search](https://docs.jabref.org/collect/import-using-online-bibliographic-database) import screen. [#560](https://github.com/koppor/jabref/issues/560)
1617
- We added a fetcher for [ISIDORE](https://isidore.science/), simply paste in the link into the text field or the last 6 digits in the link that identify that paper. [#10423](https://github.com/JabRef/jabref/issues/10423)
@@ -24,6 +25,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
2425
- We added the possibility to redownload files that had been present but are no longer in the specified location. [#10848](https://github.com/JabRef/jabref/issues/10848)
2526
- We added the citation key pattern `[camelN]`. Equivalent to the first N words of the `[camel]` pattern.
2627
- We added ability to export in CFF (Citation File Format) [#10661](https://github.com/JabRef/jabref/issues/10661).
28+
- We added ability to push entries to TeXworks. [#3197](https://github.com/JabRef/jabref/issues/3197)
29+
- We added the ability to zoom in and out in the document viewer using <kbd>Ctrl</kbd> + <kbd>Scroll</kbd>. [#10964](https://github.com/JabRef/jabref/pull/10964)
2730

2831
### Changed
2932

@@ -38,6 +41,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
3841
- We made the command "Push to TexShop" more robust to allow cite commands with a character before the first slash. [forum#2699](https://discourse.jabref.org/t/push-to-texshop-mac/2699/17?u=siedlerchr)
3942
- We only show the notification "Saving library..." if the library contains more than 2000 entries. [#9803](https://github.com/JabRef/jabref/issues/9803)
4043
- We enhanced the dialog for adding new fields in the content selector with a selection box containing a list of standard fields. [#10912](https://github.com/JabRef/jabref/pull/10912)
44+
- Keywords filed are now displayed as tags. [#10910](https://github.com/JabRef/jabref/pull/10910)
4145

4246
### Fixed
4347

@@ -52,6 +56,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
5256
- We fixed an issue where the CrossRef field did not work if autocompletion was disabled [#8145](https://github.com/JabRef/jabref/issues/8145)
5357
- We fixed an issue where exporting`@electronic` and `@online` entry types to the Office XMl would duplicate the field `title` [#10807](https://github.com/JabRef/jabref/issues/10807)
5458
- We fixed an issue where the `CommentsTab` was not properly formatted when the `defaultOwner` contained capital or special letters. [#10870](https://github.com/JabRef/jabref/issues/10870)
59+
- We fixed an issue where the `File -> Close library` menu item was not disabled when no library was open. [#10948](https://github.com/JabRef/jabref/issues/10948)
60+
- We fixed an issue where the Document Viewer would show the PDF in only half the window when maximized. [#10934](https://github.com/JabRef/jabref/issues/10934)
5561

5662
### Removed
5763

build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99

1010
id 'me.champeau.jmh' version '0.7.2'
1111

12-
id 'org.javamodularity.moduleplugin' version '1.8.13'
12+
id 'org.javamodularity.moduleplugin' version '1.8.14'
1313

1414
id 'org.openjfx.javafxplugin' version '0.1.0'
1515

@@ -27,7 +27,7 @@ plugins {
2727

2828
id 'idea'
2929

30-
id 'org.openrewrite.rewrite' version '6.8.2'
30+
id 'org.openrewrite.rewrite' version '6.8.4'
3131
}
3232

3333
// Enable following for debugging
@@ -177,7 +177,7 @@ dependencies {
177177
implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT')
178178
implementation 'org.fxmisc.flowless:flowless:0.7.2'
179179
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
180-
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.0.3') {
180+
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.2.0') {
181181
exclude module: 'javax.inject' // Split package, use only jakarta.inject
182182
exclude group: 'org.apache.logging.log4j'
183183
}
@@ -246,7 +246,7 @@ dependencies {
246246
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
247247
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.2'
248248

249-
testImplementation 'org.mockito:mockito-core:5.10.0'
249+
testImplementation 'org.mockito:mockito-core:5.11.0'
250250
testImplementation 'org.xmlunit:xmlunit-core:2.9.1'
251251
testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1'
252252
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.2.1'
@@ -260,7 +260,7 @@ dependencies {
260260
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
261261
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'
262262

263-
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.6.4"))
263+
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.7.1"))
264264
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
265265
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
266266
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")

rewrite.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ recipeList:
9494
# - org.openrewrite.staticanalysis.UseAsBuilder
9595
# "Upgrades" too much, deletes fields
9696
# - org.openrewrite.staticanalysis.UseCollectionInterfaces
97-
# Does not work at TreeNode
98-
# - org.openrewrite.staticanalysis.UseDiamondOperator
9997
# States that it gains performance, but the code is more unreable
10098
# - org.openrewrite.staticanalysis.UseForEachRemoveInsteadOfSetRemoveAll
10199
# We voted against it
@@ -189,6 +187,7 @@ recipeList:
189187
- org.openrewrite.staticanalysis.TypecastParenPad
190188
- org.openrewrite.staticanalysis.UnwrapRepeatableAnnotations
191189
- org.openrewrite.staticanalysis.UpperCaseLiteralSuffixes
190+
- org.openrewrite.staticanalysis.UseDiamondOperator
192191
# - org.openrewrite.staticanalysis.UseJavaStyleArrayDeclarations
193192
- org.openrewrite.staticanalysis.UseLambdaForFunctionalInterface
194193
# - org.openrewrite.staticanalysis.UseListSort

src/main/java/org/jabref/gui/JabRefFrame.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ private ContextMenu createTabContextMenuFor(LibraryTab tab, KeyBindingRepository
638638
factory.createMenuItem(StandardActions.OPEN_DATABASE_FOLDER, new OpenDatabaseFolder(tab::getBibDatabaseContext)),
639639
factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(tab::getBibDatabaseContext, stateManager, prefs, dialogService)),
640640
new SeparatorMenuItem(),
641-
factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction(this, tab)),
641+
factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction(this, tab, stateManager)),
642642
factory.createMenuItem(StandardActions.CLOSE_OTHER_LIBRARIES, new CloseOthersDatabaseAction(tab)),
643643
factory.createMenuItem(StandardActions.CLOSE_ALL_LIBRARIES, new CloseAllDatabaseAction()));
644644

@@ -1059,22 +1059,27 @@ static protected class CloseDatabaseAction extends SimpleCommand {
10591059
private final LibraryTabContainer tabContainer;
10601060
private final LibraryTab libraryTab;
10611061

1062-
public CloseDatabaseAction(LibraryTabContainer tabContainer, LibraryTab libraryTab) {
1062+
public CloseDatabaseAction(LibraryTabContainer tabContainer, LibraryTab libraryTab, StateManager stateManager) {
10631063
this.tabContainer = tabContainer;
10641064
this.libraryTab = libraryTab;
1065+
this.executable.bind(ActionHelper.needsDatabase(stateManager));
10651066
}
10661067

10671068
/**
10681069
* Using this constructor will result in executing the command on the currently open library tab
10691070
*/
1070-
public CloseDatabaseAction(LibraryTabContainer tabContainer) {
1071-
this(tabContainer, null);
1071+
public CloseDatabaseAction(LibraryTabContainer tabContainer, StateManager stateManager) {
1072+
this(tabContainer, null, stateManager);
10721073
}
10731074

10741075
@Override
10751076
public void execute() {
10761077
Platform.runLater(() -> {
10771078
if (libraryTab == null) {
1079+
if (tabContainer.getCurrentLibraryTab() == null) {
1080+
LOGGER.error("No library tab to close");
1081+
return;
1082+
}
10781083
tabContainer.closeCurrentTab();
10791084
} else {
10801085
tabContainer.closeTab(libraryTab);

src/main/java/org/jabref/gui/MainMenu.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private void createMenu() {
137137
factory.createMenuItem(StandardActions.SAVE_LIBRARY, new SaveAction(SaveAction.SaveMethod.SAVE, frame::getCurrentLibraryTab, dialogService, preferencesService, stateManager)),
138138
factory.createMenuItem(StandardActions.SAVE_LIBRARY_AS, new SaveAction(SaveAction.SaveMethod.SAVE_AS, frame::getCurrentLibraryTab, dialogService, preferencesService, stateManager)),
139139
factory.createMenuItem(StandardActions.SAVE_ALL, new SaveAllAction(frame::getLibraryTabs, preferencesService, dialogService)),
140-
factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new JabRefFrame.CloseDatabaseAction(frame)),
140+
factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new JabRefFrame.CloseDatabaseAction(frame, stateManager)),
141141

142142
new SeparatorMenuItem(),
143143

src/main/java/org/jabref/gui/documentviewer/DocumentViewerControl.java

+21-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import javafx.scene.control.ProgressIndicator;
1515
import javafx.scene.image.Image;
1616
import javafx.scene.image.ImageView;
17+
import javafx.scene.input.ScrollEvent;
1718
import javafx.scene.layout.StackPane;
1819
import javafx.scene.shape.Rectangle;
1920
import javafx.util.Duration;
@@ -76,6 +77,16 @@ public void show(DocumentViewModel document) {
7677
flow.estimatedScrollYProperty().addListener((observable, oldValue, newValue) -> scrollY.setValue(newValue));
7778
scrollY.addListener((observable, oldValue, newValue) -> flow.estimatedScrollYProperty().setValue((double) newValue));
7879
flow.totalLengthEstimateProperty().addListener((observable, oldValue, newValue) -> scrollYMax.setValue(newValue));
80+
flow.addEventFilter(ScrollEvent.SCROLL, (ScrollEvent event) -> {
81+
if (event.isControlDown()) {
82+
event.consume();
83+
if (event.getDeltaY() > 0) {
84+
changePageWidth(100);
85+
} else {
86+
changePageWidth(-100);
87+
}
88+
}
89+
});
7990
}
8091

8192
private void updateCurrentPage(ObservableList<DocumentViewerPage> visiblePages) {
@@ -128,7 +139,16 @@ private void updateSizeOfDisplayedPages() {
128139

129140
public void changePageWidth(int delta) {
130141
// Assuming the current page is A4 (or has same aspect ratio)
131-
setPageWidth(desiredPageDimension.getWidth(Math.sqrt(2)) + delta);
142+
int newWidth = desiredPageDimension.getWidth(Math.sqrt(2)) + delta;
143+
// Limit zoom out to ~1 page due to occasional display errors when zooming out further
144+
int minWidth = (int) (flow.getHeight() / 2 * Math.sqrt(2));
145+
if (newWidth < minWidth) {
146+
if (newWidth - delta == minWidth) { // Attempting to zoom out when already at minWidth
147+
return;
148+
}
149+
newWidth = minWidth;
150+
}
151+
setPageWidth(newWidth);
132152
}
133153

134154
/**

src/main/java/org/jabref/gui/documentviewer/DocumentViewerView.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public DocumentViewerView() {
4747

4848
ViewLoader.view(this)
4949
.load()
50-
.setAsContent(this.getDialogPane());
50+
.setAsDialogPane(this);
5151

5252
// Remove button bar at bottom, but add close button to keep the dialog closable by clicking the "x" window symbol
5353
getDialogPane().getButtonTypes().add(ButtonType.CLOSE);

src/main/java/org/jabref/gui/entryeditor/citationrelationtab/BibEntryRelationsRepository.java

+20-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
import org.jabref.logic.importer.FetcherException;
77
import org.jabref.model.entry.BibEntry;
88

9+
import org.slf4j.Logger;
10+
import org.slf4j.LoggerFactory;
11+
912
public class BibEntryRelationsRepository {
13+
private static final Logger LOGGER = LoggerFactory.getLogger(BibEntryRelationsRepository.class);
14+
1015
private final SemanticScholarFetcher fetcher;
1116
private final BibEntryRelationsCache cache;
1217

@@ -25,7 +30,13 @@ public List<BibEntry> getCitations(BibEntry entry) {
2530

2631
public List<BibEntry> getReferences(BibEntry entry) {
2732
if (needToRefreshReferences(entry)) {
28-
List<BibEntry> references = fetcher.searchCiting(entry);
33+
List<BibEntry> references;
34+
try {
35+
references = fetcher.searchCiting(entry);
36+
} catch (FetcherException e) {
37+
LOGGER.error("Error while fetching references", e);
38+
references = List.of();
39+
}
2940
cache.cacheOrMergeReferences(entry, references);
3041
}
3142

@@ -37,7 +48,7 @@ public void forceRefreshCitations(BibEntry entry) {
3748
List<BibEntry> citations = fetcher.searchCitedBy(entry);
3849
cache.cacheOrMergeCitations(entry, citations);
3950
} catch (FetcherException e) {
40-
throw new RuntimeException(e);
51+
LOGGER.error("Error while fetching citations", e);
4152
}
4253
}
4354

@@ -50,7 +61,13 @@ public boolean needToRefreshReferences(BibEntry entry) {
5061
}
5162

5263
public void forceRefreshReferences(BibEntry entry) {
53-
List<BibEntry> references = fetcher.searchCiting(entry);
64+
List<BibEntry> references;
65+
try {
66+
references = fetcher.searchCiting(entry);
67+
} catch (FetcherException e) {
68+
LOGGER.error("Error while fetching references", e);
69+
references = List.of();
70+
}
5471
cache.cacheOrMergeReferences(entry, references);
5572
}
5673
}

src/main/java/org/jabref/gui/entryeditor/citationrelationtab/semanticscholar/SemanticScholarFetcher.java

+5-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import java.io.IOException;
44
import java.net.URI;
55
import java.net.URL;
6-
import java.util.ArrayList;
76
import java.util.List;
87

98
import org.jabref.logic.importer.FetcherException;
@@ -50,15 +49,14 @@ public List<BibEntry> searchCitedBy(BibEntry entry) throws FetcherException {
5049
.stream().filter(citationDataItem -> citationDataItem.getCitingPaper() != null)
5150
.map(citationDataItem -> citationDataItem.getCitingPaper().toBibEntry()).toList();
5251
} catch (IOException e) {
53-
throw new RuntimeException(e);
52+
throw new FetcherException("Could not fetch", e);
5453
}
5554
}
56-
57-
return new ArrayList<>();
55+
return List.of();
5856
}
5957

6058
@Override
61-
public List<BibEntry> searchCiting(BibEntry entry) {
59+
public List<BibEntry> searchCiting(BibEntry entry) throws FetcherException {
6260
if (entry.getDOI().isPresent()) {
6361
StringBuilder urlBuilder = new StringBuilder(SEMANTIC_SCHOLAR_API)
6462
.append("paper/")
@@ -82,11 +80,10 @@ public List<BibEntry> searchCiting(BibEntry entry) {
8280
.filter(citationDataItem -> citationDataItem.getCitedPaper() != null)
8381
.map(referenceDataItem -> referenceDataItem.getCitedPaper().toBibEntry()).toList();
8482
} catch (IOException e) {
85-
throw new RuntimeException(e);
83+
throw new FetcherException("Could not fetch", e);
8684
}
8785
}
88-
89-
return new ArrayList<>();
86+
return List.of();
9087
}
9188

9289
@Override

src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static FieldEditorFX getForField(final Field field,
9696
} else if (fieldProperties.contains(FieldProperty.PERSON_NAMES)) {
9797
return new PersonsEditor(field, suggestionProvider, preferences, fieldCheckers, isMultiLine, undoManager);
9898
} else if (StandardField.KEYWORDS == field) {
99-
return new KeywordsEditor(field, suggestionProvider, fieldCheckers, preferences, undoManager);
99+
return new KeywordsEditor(field, suggestionProvider, fieldCheckers);
100100
} else if (field == InternalField.KEY_FIELD) {
101101
return new CitationKeyEditor(field, suggestionProvider, fieldCheckers, databaseContext);
102102
} else if (fieldProperties.contains(FieldProperty.MARKDOWN)) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.layout.HBox?>
4+
<?import com.dlsc.gemsfx.TagsField?>
5+
<fx:root xmlns:fx="http://javafx.com/fxml/1" type="HBox" xmlns="http://javafx.com/javafx/8.0.112"
6+
fx:controller="org.jabref.gui.fieldeditors.KeywordsEditor" >
7+
<TagsField fx:id="keywordTagsField" HBox.hgrow="ALWAYS"/>
8+
</fx:root>

0 commit comments

Comments
 (0)