Skip to content

Commit

Permalink
Merge branch 'main' into vector-api
Browse files Browse the repository at this point in the history
  • Loading branch information
calixtus authored Jul 31, 2024
2 parents 454a653 + 7be96c6 commit d7a5ed4
Show file tree
Hide file tree
Showing 85 changed files with 1,450 additions and 991 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deployment-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ jobs:
submodules: 'true'
show-progress: 'false'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v2.0.0
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: "5.x"
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v2.0.0
uses: gittools/actions/gitversion/execute@v3.0.0
- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deployment-jdk-ea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ jobs:
packages: pigz
version: 1.0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v2.0.0
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: "5.x"
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v2.0.0
uses: gittools/actions/gitversion/execute@v3.0.0

# JDK
- name: 'Set up JDK ${{ matrix.jdk }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ jobs:
packages: pigz
version: 1.0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v2.0.0
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: "5.x"
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v2.0.0
uses: gittools/actions/gitversion/execute@v3.0.0
- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Added

- We added support for selecting and using CSL Styles in JabRef's OpenOffice/LibreOffice integration for inserting bibliographic and in-text citations into a document. [#2146](https://github.com/JabRef/jabref/issues/2146), [#8893](https://github.com/JabRef/jabref/issues/8893)
- We added Tools > New library based on references in PDF file... to create a new library based on the references section in a PDF file. [#11522](https://github.com/JabRef/jabref/pull/11522)
- When converting the references section of a paper (PDF file), more than the last page is treated. [#11522](https://github.com/JabRef/jabref/pull/11522)
- Added minimal support for [biblatex data annotation](https://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf#subsection.3.7) fields in .layout files. [#11505](https://github.com/JabRef/jabref/issues/11505)
- Added saving of selected options in the [Lookup -> Search for unlinked local files dialog](https://docs.jabref.org/collect/findunlinkedfiles#link-the-pdfs-to-your-bib-library). [#11439](https://github.com/JabRef/jabref/issues/11439)

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ sourceSets {

repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/groups/public' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://jitpack.io' }
maven { url 'https://oss.sonatype.org/content/groups/public' }
maven { url 'https://sandec.jfrog.io/artifactory/repo' }
}

Expand Down Expand Up @@ -169,7 +169,7 @@ dependencies {
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.15.0'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.12.0'
implementation 'commons-logging:commons-logging:1.3.3'
implementation 'com.h2database:h2-mvstore:2.2.224'
implementation 'com.h2database:h2-mvstore:2.3.230'

// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
implementation 'org.bouncycastle:bcprov-jdk18on:1.78.1'
Expand Down Expand Up @@ -221,7 +221,7 @@ dependencies {
implementation 'org.kordamp.ikonli:ikonli-materialdesign2-pack:12.3.1'
implementation 'com.github.sialcasa.mvvmFX:mvvmfx-validation:f195849ca9' //jitpack
implementation 'de.saxsys:mvvmfx:1.8.0'
implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT') {
implementation('org.jabref:easybind:2.2.1-SNAPSHOT') {
exclude group: 'org.openjfx'
}
implementation 'org.fxmisc.flowless:flowless:0.7.3'
Expand All @@ -241,8 +241,8 @@ dependencies {
implementation 'org.controlsfx:controlsfx:11.2.1'

implementation 'org.jsoup:jsoup:1.18.1'
implementation 'com.konghq:unirest-java-core:4.4.0'
implementation 'com.konghq:unirest-modules-gson:4.4.0'
implementation 'com.konghq:unirest-java-core:4.4.4'
implementation 'com.konghq:unirest-modules-gson:4.4.4'
implementation 'org.apache.httpcomponents.client5:httpclient5:5.3.1'

implementation 'org.slf4j:slf4j-api:2.0.13'
Expand Down
2 changes: 1 addition & 1 deletion rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ recipeList:
# - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables
# - org.openrewrite.staticanalysis.RemoveUnusedPrivateFields
# - org.openrewrite.staticanalysis.RenameLocalVariablesToCamelCase
- org.openrewrite.staticanalysis.RenameMethodsNamedHashcodeEqualOrTostring
- org.openrewrite.staticanalysis.RenameMethodsNamedHashcodeEqualOrToString
- org.openrewrite.staticanalysis.ReplaceRedundantFormatWithPrintf
- org.openrewrite.staticanalysis.ReplaceStringBuilderWithString
- org.openrewrite.staticanalysis.ReplaceWeekYearWithYear
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pluginManagement {
// Updated solution at https://github.com/foodiestudio/convention-plugins?tab=readme-ov-file#convention-plugins
if (requested.id.id.startsWith("com.github.koppor")) {
// This is https://github.com/java9-modularity/gradle-modules-plugin/pull/282
useModule("com.github.koppor:gradle-modules-plugin:jitpack-SNAPSHOT")
useModule("com.github.koppor:gradle-modules-plugin:1.8.15-cmd-1")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Annotation to indicate that usage of ApacheCommonsLang3 is explicitly allowed.
* The intention is to fully switch to Google Guava and only use Apache Commons Lang3 if there is no other possibility
*/
public @interface ApacheCommonsLang3Allowed {
public @interface AllowedToUseApacheCommonsLang3 {

// The rationale
String value();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public enum StandardActions implements Action {

PARSE_LATEX(Localization.lang("Search for citations in LaTeX files..."), IconTheme.JabRefIcons.LATEX_CITATIONS),
NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary") + Localization.lang("This feature generates a new library based on which entries are needed in an existing LaTeX document."), IconTheme.JabRefIcons.NEW),
NEW_LIBRARY_FROM_PDF_ONLINE(Localization.lang("New library based on references in PDF file... (online)"), Localization.lang("This feature generates a new library based on the list of references in a PDF file. Thereby, it uses GROBID's functionality."), IconTheme.JabRefIcons.NEW),
NEW_LIBRARY_FROM_PDF_OFFLINE(Localization.lang("New library based on references in PDF file... (offline)"), Localization.lang("This feature generates a new library based on the list of references in a PDF file. Thereby, it uses JabRef's build-in functionality.."), IconTheme.JabRefIcons.NEW),
WRITE_METADATA_TO_PDF(Localization.lang("Write metadata to PDF files"), Localization.lang("Will write metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_METADATA_TO_PDF),

START_NEW_STUDY(Localization.lang("Start new systematic literature review")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.gui.util.ViewModelTreeCellFactory;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
Expand Down Expand Up @@ -104,6 +105,7 @@ public UnlinkedFilesDialogView() {
if (button == ButtonType.CANCEL) {
viewModel.cancelTasks();
}
saveConfiguration();
return null;
});

Expand Down Expand Up @@ -236,7 +238,7 @@ private void loadSavedConfiguration() {
.stream()
.filter(item -> Objects.equals(item.getName(), unlinkedFilesDialogPreferences.getUnlinkedFilesSelectedExtension()))
.findFirst()
.orElseThrow();
.orElseGet(() -> new FileExtensionViewModel(StandardFileType.ANY_FILE, preferencesService.getFilePreferences()));
fileTypeCombo.getSelectionModel().select(selectedExtension);
fileDateCombo.getSelectionModel().select(unlinkedFilesDialogPreferences.getUnlinkedFilesSelectedDateRange());
fileSortCombo.getSelectionModel().select(unlinkedFilesDialogPreferences.getUnlinkedFilesSelectedSort());
Expand All @@ -256,7 +258,6 @@ void browseFileDirectory() {
@FXML
void scanFiles() {
viewModel.startSearch();
saveConfiguration();
}

@FXML
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/jabref/gui/frame/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.jabref.gui.journals.AbbreviateAction;
import org.jabref.gui.libraryproperties.LibraryPropertiesAction;
import org.jabref.gui.linkedfile.RedownloadMissingFilesAction;
import org.jabref.gui.maintable.NewLibraryFromPdfAction;
import org.jabref.gui.mergeentries.MergeEntriesAction;
import org.jabref.gui.preferences.ShowPreferencesAction;
import org.jabref.gui.preview.CopyCitationAction;
Expand Down Expand Up @@ -80,6 +81,8 @@
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;

import com.tobiasdiez.easybind.EasyBind;

public class MainMenu extends MenuBar {
private final JabRefFrame frame;
private final FileHistoryMenu fileHistoryMenu;
Expand Down Expand Up @@ -273,9 +276,17 @@ private void createMenu() {
final MenuItem pushToApplicationMenuItem = factory.createMenuItem(pushToApplicationCommand.getAction(), pushToApplicationCommand);
pushToApplicationCommand.registerReconfigurable(pushToApplicationMenuItem);

NewLibraryFromPdfAction newLibraryFromPdfAction = new NewLibraryFromPdfAction(frame, stateManager, dialogService, preferencesService, taskExecutor);
// Action used twice, because it distinguishes internally between online and offline
// We want the UI to show "online" and "offline" explicitly
MenuItem newLibraryFromPdfMenuItemOnline = factory.createMenuItem(StandardActions.NEW_LIBRARY_FROM_PDF_ONLINE, newLibraryFromPdfAction);
MenuItem newLibraryFromPdfMenuItemOffline = factory.createMenuItem(StandardActions.NEW_LIBRARY_FROM_PDF_OFFLINE, newLibraryFromPdfAction);

tools.getItems().addAll(
factory.createMenuItem(StandardActions.PARSE_LATEX, new ParseLatexAction(stateManager)),
factory.createMenuItem(StandardActions.NEW_SUB_LIBRARY_FROM_AUX, new NewSubLibraryAction(frame, stateManager, dialogService)),
newLibraryFromPdfMenuItemOnline,
newLibraryFromPdfMenuItemOffline,

new SeparatorMenuItem(),

Expand Down Expand Up @@ -303,6 +314,9 @@ private void createMenu() {

factory.createMenuItem(StandardActions.REDOWNLOAD_MISSING_FILES, new RedownloadMissingFilesAction(stateManager, dialogService, preferencesService.getFilePreferences(), taskExecutor))
);

EasyBind.subscribe(preferencesService.getGrobidPreferences().grobidEnabledProperty(), newLibraryFromPdfMenuItemOnline::setVisible);

SidePaneType webSearchPane = SidePaneType.WEB_SEARCH;
SidePaneType groupsPane = SidePaneType.GROUPS;
SidePaneType openOfficePane = SidePaneType.OPEN_OFFICE;
Expand Down
46 changes: 25 additions & 21 deletions src/main/java/org/jabref/gui/maintable/ExtractReferencesAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.importer.ImportEntriesDialog;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.importer.fileformat.BibliographyFromPdfImporter;
import org.jabref.logic.importer.util.GrobidService;
Expand All @@ -33,30 +32,28 @@
/**
* SIDE EFFECT: Sets the "cites" field of the entry having the linked files
*
* Mode choice A: online or offline
* Mode choice B: complete entry or single file (the latter is not implemented)
* <ul>
* <li>Mode choice A: online or offline</li>
* <li>Mode choice B: complete entry or single file (the latter is not implemented)</li>
* </ul>
*
* The different modes should be implemented as sub classes. However, this was too complicated, thus we use variables at the constructor to parameterize this class.
* The mode is selected by the preferences whether to use Grobid or not.
*/
public class ExtractReferencesAction extends SimpleCommand {
private final int FILES_LIMIT = 10;

private final boolean online;
private final DialogService dialogService;
private final StateManager stateManager;
private final PreferencesService preferencesService;
private final BibEntry entry;
private final LinkedFile linkedFile;
private final TaskExecutor taskExecutor;

private final BibliographyFromPdfImporter bibliographyFromPdfImporter;

public ExtractReferencesAction(boolean online,
DialogService dialogService,
public ExtractReferencesAction(DialogService dialogService,
StateManager stateManager,
PreferencesService preferencesService,
TaskExecutor taskExecutor) {
this(online, dialogService, stateManager, preferencesService, null, null, taskExecutor);
PreferencesService preferencesService) {
this(dialogService, stateManager, preferencesService, null, null);
}

/**
Expand All @@ -65,20 +62,16 @@ public ExtractReferencesAction(boolean online,
* @param entry the entry to handle (can be null)
* @param linkedFile the linked file (can be null)
*/
private ExtractReferencesAction(boolean online,
@NonNull DialogService dialogService,
private ExtractReferencesAction(@NonNull DialogService dialogService,
@NonNull StateManager stateManager,
@NonNull PreferencesService preferencesService,
@Nullable BibEntry entry,
@Nullable LinkedFile linkedFile,
@NonNull TaskExecutor taskExecutor) {
this.online = online;
@Nullable LinkedFile linkedFile) {
this.dialogService = dialogService;
this.stateManager = stateManager;
this.preferencesService = preferencesService;
this.entry = entry;
this.linkedFile = linkedFile;
this.taskExecutor = taskExecutor;
bibliographyFromPdfImporter = new BibliographyFromPdfImporter(preferencesService.getCitationKeyPatternPreferences());

if (this.linkedFile == null) {
Expand All @@ -98,15 +91,14 @@ public void execute() {

private void extractReferences() {
stateManager.getActiveDatabase().ifPresent(databaseContext -> {
assert online == this.preferencesService.getGrobidPreferences().isGrobidEnabled();

List<BibEntry> selectedEntries;
if (entry == null) {
selectedEntries = stateManager.getSelectedEntries();
} else {
selectedEntries = List.of(entry);
}

boolean online = this.preferencesService.getGrobidPreferences().isGrobidEnabled();
Callable<ParserResult> parserResultCallable;
if (online) {
Optional<Callable<ParserResult>> parserResultCallableOnline = getParserResultCallableOnline(databaseContext, selectedEntries);
Expand Down Expand Up @@ -166,9 +158,21 @@ private void extractReferences(Iterator<Path> fileListIterator, ParserResult res
result.getDatabase().insertEntries(bibliographyFromPdfImporter.importDatabase(fileListIterator.next()).getDatabase().getEntries());
}

String cites = getCites(result.getDatabase().getEntries(), currentEntry);
currentEntry.setField(StandardField.CITES, cites);
}

/**
* Creates the field content for the "cites" field. The field contains the citation keys of the imported entries.
*
* TODO: Move this part to logic somehow
*
* @param currentEntry used to create citation keys if the importer did not provide one from the imported entry
*/
private static String getCites(List<BibEntry> entries, BibEntry currentEntry) {
StringJoiner cites = new StringJoiner(",");
int count = 0;
for (BibEntry importedEntry : result.getDatabase().getEntries()) {
for (BibEntry importedEntry : entries) {
count++;
Optional<String> citationKey = importedEntry.getCitationKey();
String citationKeyToAdd;
Expand All @@ -195,7 +199,7 @@ private void extractReferences(Iterator<Path> fileListIterator, ParserResult res
}
cites.add(citationKeyToAdd);
}
currentEntry.setField(StandardField.CITES, cites.toString());
return cites.toString();
}

private Optional<Callable<ParserResult>> getParserResultCallableOnline(BibDatabaseContext databaseContext, List<BibEntry> selectedEntries) {
Expand Down
Loading

0 comments on commit d7a5ed4

Please sign in to comment.