Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into jabrefonline
Browse files Browse the repository at this point in the history
* upstream/main:
  Consider directory pattern when checking if a file can be moved (#8244)
  Bump byte-buddy-parent from 1.12.1 to 1.12.2 (#8285)
  Bump unirest-java from 3.13.3 to 3.13.4 (#8283)
  Bump checkstyle from 9.1 to 9.2 (#8284)
  Bump classgraph from 4.8.135 to 4.8.137 (#8282)
  Do not resize main table columns in search dialog window (#8253)
  Fix NegativeArraySizeException (#8270)
  Update deployment.yml
  TEst
  Grand unified library properties (GRULPS) (#8264)
  Fixes RFC fetcher test case (#8271)
  Update Gradle Wrapper from 7.2 to 7.3 (#8246)
  Observable Preferences H (WorkingDir, getUser, NameFormatter, Version, SpecialFields) (#8260)
  Bump checkstyle from 9.0.1 to 9.1 (#8266)
  Bump mockito-core from 4.0.0 to 4.1.0 (#8267)
  Bump classgraph from 4.8.130 to 4.8.135 (#8268)
  Fix some fetcher tests (#8258)
  Clicking a DOI link in the preview pane no longer crashes (#8255)
  • Loading branch information
Siedlerchr committed Nov 30, 2021
2 parents 6aad7f2 + 217f902 commit 498a8e9
Show file tree
Hide file tree
Showing 117 changed files with 1,966 additions and 1,592 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ env:
JAVA_OPTS: -Xmx4g

concurrency:
group: ${{ github.head_ref }}
group: ${{ github.ref }}
cancel-in-progress: true


jobs:
build:
strategy:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We allowed the user to also preview the available citation styles in the preferences besides the selected ones [#8108](https://github.com/JabRef/jabref/issues/8108)
- We added an option to search the available citation styles by name in the preferences [#8108](https://github.com/JabRef/jabref/issues/8108)
- We added an option to generate bib-entries from ID through a popover in the toolbar. [#4183](https://github.com/JabRef/jabref/issues/4183)
- We added a menu option in the right click menu of the main table tabs to display the library properties. [#6527](https://github.com/JabRef/jabref/issues/6527)
- When a `.bib` file ("library") was saved successfully, a notification is shown

### Changed

Expand All @@ -49,9 +51,11 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We present options to manually enter an article or return to the New Entry menu when the fetcher DOI fails to find an entry for an ID [#7870](https://github.com/JabRef/jabref/issues/7870)
- We trim white space and non-ASCII characters from DOI [#8127](https://github.com/JabRef/jabref/issues/8127)
- The duplicate checker now inspects other fields in case no difference in the required and optional fields are found.
- We reworked the library properties dialog and integrated the `Library > Preamble`, `Library > Citation key pattern` and `Library > String constants dialogs` [#8264](https://github.com/JabRef/jabref/pulls/8264)

### Fixed

- We fixed an issue where the actions to move a file to a directory were incorrectly disabled. [#7908](https://github.com/JabRef/jabref/issues/7908)
- We fixed an issue where an exception occurred when a linked online file was edited in the entry editor [#8008](https://github.com/JabRef/jabref/issues/8008)
- We fixed an issue when checking for a new version when JabRef is used behind a corporate proxy. [#7884](https://github.com/JabRef/jabref/issues/7884)
- We fixed some icons that were drawn in the wrong color when JabRef used a custom theme. [#7853](https://github.com/JabRef/jabref/issues/7853)
Expand All @@ -64,8 +68,10 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where importing PDFs resulted in an uncaught exception [#8143](https://github.com/JabRef/jabref/issues/8143)
- We fixed "The library has been modified by another program" showing up when line breaks change [#4877](https://github.com/JabRef/jabref/issues/4877)
- The default directory of the "LaTeX Citations" tab is now the directory of the currently opened database (and not the directory chosen at the last open file dialog or the last database save) [koppor#538](https://github.com/koppor/jabref/issues/538)
- When writing a bib file, the `NegativeArraySizeException` should not occur [#8231](https://github.com/JabRef/jabref/issues/8231) [#8265](https://github.com/JabRef/jabref/issues/8265)
- We fixed an issue where right-clicking on a tab and selecting close will close the focused tab even if it is not the tab we right-clicked [#8193](https://github.com/JabRef/jabref/pull/8193)
- We fixed an issue where selecting a citation style in the preferences would sometimes produce an exception [#7860](https://github.com/JabRef/jabref/issues/7860)
- We fixed an issue where an exception would occur when clicking on a DOI link in the preview pane [#7706](https://github.com/JabRef/jabref/issues/7706)

### Removed

Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.jabref.build.xjc.XjcTask
plugins {
id 'application'

id "com.simonharrer.modernizer" version '2.1.0-1'
id 'com.github.andygoossens.modernizer' version '1.6.1'

id 'me.champeau.gradle.jmh' version '0.5.3'

Expand Down Expand Up @@ -178,7 +178,7 @@ dependencies {
implementation 'org.controlsfx:controlsfx:11.1.0'

implementation 'org.jsoup:jsoup:1.14.3'
implementation 'com.konghq:unirest-java:3.13.3'
implementation 'com.konghq:unirest-java:3.13.4'

implementation 'org.slf4j:slf4j-api:2.0.0-alpha5'
implementation group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT'
Expand Down Expand Up @@ -209,14 +209,14 @@ dependencies {

implementation group: 'net.harawata', name: 'appdirs', version: '1.2.1'

testImplementation 'io.github.classgraph:classgraph:4.8.130'
testImplementation 'io.github.classgraph:classgraph:4.8.137'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
testImplementation 'org.junit.platform:junit-platform-launcher:1.8.1'

testImplementation 'net.bytebuddy:byte-buddy-parent:1.12.1'
testImplementation 'net.bytebuddy:byte-buddy-parent:1.12.2'
testRuntimeOnly group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntimeOnly group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testImplementation 'org.mockito:mockito-core:4.0.0'
testImplementation 'org.mockito:mockito-core:4.1.0'
testImplementation 'org.xmlunit:xmlunit-core:2.8.3'
testImplementation 'org.xmlunit:xmlunit-matchers:2.8.3'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:0.22.0'
Expand All @@ -225,7 +225,7 @@ dependencies {
testImplementation "org.testfx:testfx-junit5:4.0.17-alpha-SNAPSHOT"
testImplementation "org.hamcrest:hamcrest-library:2.2"

checkstyle 'com.puppycrawl.tools:checkstyle:9.0.1'
checkstyle 'com.puppycrawl.tools:checkstyle:9.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '2.3.3'
}

Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=f581709a9c35e9cb92e16f585d2c4bc99b2b1a5f85d2badbd3dc6bff59e1e6dd
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,28 +310,28 @@ private void writeMetadatatoPDFsOfEntry(BibDatabaseContext databaseContext, Stri
try {
if (writeXMP) {
if (xmpPdfExporter.exportToAllFilesOfEntry(databaseContext, encoding, filePreferences, entry, List.of(entry))) {
System.out.println(String.format("Successfully written XMP metadata on at least one linked file of %s", citeKey));
System.out.printf("Successfully written XMP metadata on at least one linked file of %s%n", citeKey);
} else {
System.err.println(String.format("Cannot write XMP metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.", citeKey));
System.err.printf("Cannot write XMP metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.%n", citeKey);
}
}
if (embeddBibfile) {
if (embeddedBibFilePdfExporter.exportToAllFilesOfEntry(databaseContext, encoding, filePreferences, entry, List.of(entry))) {
System.out.println(String.format("Successfully embedded metadata on at least one linked file of %s", citeKey));
System.out.printf("Successfully embedded metadata on at least one linked file of %s%n", citeKey);
} else {
System.out.println(String.format("Cannot embedd metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.", citeKey));
System.out.printf("Cannot embedd metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.%n", citeKey);
}
}
} catch (Exception e) {
LOGGER.error(String.format("Failed writing metadata on a linked file of %s.", citeKey));
LOGGER.error("Failed writing metadata on a linked file of {}.", citeKey);
}
}

private void writeMetadatatoPdfByCitekey(BibDatabaseContext databaseContext, BibDatabase dataBase, Vector<String> citeKeys, Charset encoding, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, boolean writeXMP, boolean embeddBibfile) {
for (String citeKey : citeKeys) {
List<BibEntry> bibEntryList = dataBase.getEntriesByCitationKey(citeKey);
if (bibEntryList.isEmpty()) {
System.err.println(String.format("Skipped - Cannot find %s in library.", citeKey));
System.err.printf("Skipped - Cannot find %s in library.%n", citeKey);
continue;
}
for (BibEntry entry : bibEntryList) {
Expand All @@ -350,25 +350,25 @@ private void writeMetadatatoPdfByFileNames(BibDatabaseContext databaseContext, B
try {
if (writeXMP) {
if (xmpPdfExporter.exportToFileByPath(databaseContext, dataBase, encoding, filePreferences, filePath)) {
System.out.println(String.format("Successfully written XMP metadata of at least one entry to %s", fileName));
System.out.printf("Successfully written XMP metadata of at least one entry to %s%n", fileName);
} else {
System.out.println(String.format("File %s is not linked to any entry in database.", fileName));
System.out.printf("File %s is not linked to any entry in database.%n", fileName);
}
}
if (embeddBibfile) {
if (embeddedBibFilePdfExporter.exportToFileByPath(databaseContext, dataBase, encoding, filePreferences, filePath)) {
System.out.println(String.format("Successfully embedded XMP metadata of at least one entry to %s", fileName));
System.out.printf("Successfully embedded XMP metadata of at least one entry to %s%n", fileName);
} else {
System.out.println(String.format("File %s is not linked to any entry in database.", fileName));
System.out.printf("File %s is not linked to any entry in database.%n", fileName);
}
}
} catch (IOException e) {
LOGGER.error("Error accessing file '{}'.", fileName);
} catch (Exception e) {
LOGGER.error(String.format("Error writing entry to %s.", fileName));
LOGGER.error("Error writing entry to {}.", fileName);
}
} else {
LOGGER.error(String.format("Skipped - PDF %s does not exist", fileName));
LOGGER.error("Skipped - PDF {} does not exist", fileName);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/DialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String
<V> Optional<ButtonType> showBackgroundProgressDialogAndWait(String title, String content, StateManager stateManager);

/**
* Notify the user in an non-blocking way (i.e., in form of toast in a snackbar).
* Notify the user in a non-blocking way (i.e., in form of toast in a snackbar).
*
* @param message the message to show.
*/
Expand Down
38 changes: 17 additions & 21 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.auximport.NewSubLibraryAction;
import org.jabref.gui.bibtexextractor.ExtractBibtexAction;
import org.jabref.gui.citationkeypattern.CitationKeyPatternAction;
import org.jabref.gui.citationkeypattern.GenerateCitationKeyAction;
import org.jabref.gui.cleanup.CleanupAction;
import org.jabref.gui.contentselector.ManageContentSelectorAction;
Expand Down Expand Up @@ -101,8 +100,6 @@
import org.jabref.gui.libraryproperties.LibraryPropertiesAction;
import org.jabref.gui.menus.FileHistoryMenu;
import org.jabref.gui.mergeentries.MergeEntriesAction;
import org.jabref.gui.metadata.BibtexStringEditorAction;
import org.jabref.gui.metadata.PreambleEditor;
import org.jabref.gui.preferences.ShowPreferencesAction;
import org.jabref.gui.preview.CopyCitationAction;
import org.jabref.gui.push.PushToApplicationAction;
Expand Down Expand Up @@ -754,19 +751,20 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.MASS_SET_FIELDS, new MassSetFieldsAction(stateManager, dialogService, undoManager))
);

if (prefs.getSpecialFieldsPreferences().isSpecialFieldsEnabled()) {
edit.getItems().addAll(
new SeparatorMenuItem(),
// ToDo: SpecialField needs the active BasePanel to mark it as changed.
// Refactor BasePanel, should mark the BibDatabaseContext or the UndoManager as dirty instead!
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.RANKING, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.RELEVANCE, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.QUALITY, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.PRINTED, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.PRIORITY, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.READ_STATUS, factory, this, dialogService, prefs, undoManager, stateManager)
);
}
SeparatorMenuItem specialFieldsSeparator = new SeparatorMenuItem();
specialFieldsSeparator.visibleProperty().bind(prefs.getSpecialFieldsPreferences().specialFieldsEnabledProperty());

edit.getItems().addAll(
specialFieldsSeparator,
// ToDo: SpecialField needs the active BasePanel to mark it as changed.
// Refactor BasePanel, should mark the BibDatabaseContext or the UndoManager as dirty instead!
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.RANKING, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.RELEVANCE, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.QUALITY, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.PRINTED, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.PRIORITY, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.READ_STATUS, factory, this, dialogService, prefs, undoManager, stateManager)
);

// @formatter:off
library.getItems().addAll(
Expand All @@ -776,10 +774,7 @@ private MenuBar createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this, stateManager)),
factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new PreambleEditor(stateManager, undoManager, this.getDialogService())),
factory.createMenuItem(StandardActions.EDIT_STRINGS, new BibtexStringEditorAction(stateManager)),
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new CitationKeyPatternAction(this, stateManager))
factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(stateManager))
);

quality.getItems().addAll(
Expand Down Expand Up @@ -1050,6 +1045,7 @@ private ContextMenu createTabContextMenuFor(LibraryTab tab, KeyBindingRepository
ActionFactory factory = new ActionFactory(keyBindingRepository);

contextMenu.getItems().addAll(
factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(tab.getBibDatabaseContext(), stateManager)),
factory.createMenuItem(StandardActions.OPEN_DATABASE_FOLDER, new OpenDatabaseFolder(tab.getBibDatabaseContext())),
factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(tab.getBibDatabaseContext(), stateManager, prefs)),
new SeparatorMenuItem(),
Expand Down Expand Up @@ -1192,7 +1188,7 @@ private Boolean confirmEmptyEntry(LibraryTab libraryTab, BibDatabaseContext cont
if (response.isPresent() && response.get().equals(deleteEmptyEntries)) {
// The user wants to delete.
try {
for (BibEntry currentEntry : new ArrayList<BibEntry>(context.getEntries())) {
for (BibEntry currentEntry : new ArrayList<>(context.getEntries())) {
if (currentEntry.getFields().isEmpty()) {
context.getDatabase().removeEntries(Collections.singletonList(currentEntry));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public JabRefGUI(Stage mainStage, List<ParserResult> databases, boolean isBlank,
openWindow(mainStage);

new VersionWorker(Globals.BUILD_INFO.version,
preferencesService.getVersionPreferences().getIgnoredVersion(),
mainFrame.getDialogService(),
Globals.TASK_EXECUTOR)
Globals.TASK_EXECUTOR,
preferencesService.getVersionPreferences())
.checkForNewVersionDelayed();
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.gui.maintable.MainTable;
import org.jabref.gui.maintable.MainTableDataModel;
import org.jabref.gui.specialfields.SpecialFieldDatabaseChangeListener;
import org.jabref.gui.undo.CountingUndoManager;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableFieldChange;
Expand Down Expand Up @@ -465,8 +464,6 @@ public void editEntryAndFocusField(BibEntry entry, Field field) {
}

private void createMainTable() {
bibDatabaseContext.getDatabase().registerListener(SpecialFieldDatabaseChangeListener.INSTANCE);

mainTable = new MainTable(tableModel,
this,
bibDatabaseContext,
Expand Down
Loading

0 comments on commit 498a8e9

Please sign in to comment.