Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into customizeEntrydlg
Browse files Browse the repository at this point in the history
# By Oliver Kopp (4) and others
# Via github actions (3) and Christoph (1)
* upstream/master:
  Fix missing file extension for downloaded files. Fixes #5816 by falling back to PDF as default file type. (#5841)
  The PDF has a title - try another publication without an available PDF (#5840)
  Fix BibTeX VM for IEEE (and some micro other fixes) (#5839)
  Squashed 'src/main/resources/csl-styles/' changes from 19c89f5..9c0f5c6
  Improve serialization to fix #4877 (#5838)
  Build on all branches
  update unirest (#5836)
  Squashed 'src/main/resources/csl-locales/' changes from a3e8843f75..41da445acc
  Squashed 'src/main/resources/csl-styles/' changes from bb01625..19c89f5
  Build binaries only when src/main changes (#5806)
  Bump archunit-junit5-api from 0.12.0 to 0.13.0 (#5827)
  Bump classgraph from 4.8.59 to 4.8.60 (#5828)
  Bump mariadb-java-client from 2.5.2 to 2.5.3 (#5829)
  Update jdk to build 30
  Improve change detection (#5824)

# Conflicts:
#	src/main/resources/l10n/JabRef_en.properties
  • Loading branch information
Siedlerchr committed Jan 18, 2020
2 parents dff6163 + 2612e22 commit f5ba88e
Show file tree
Hide file tree
Showing 100 changed files with 12,073 additions and 1,105 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
name: Deployment

on: [push]
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'src/test/**'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'src/test/**'
- 'README.md'

jobs:
build:
Expand All @@ -11,17 +23,17 @@ jobs:
include:
- os: ubuntu-latest
displayName: linux
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_linux-x64_bin.tar.gz
jpackageDownload: https://download.java.net/java/early_access/jdk14/30/GPL/openjdk-14-ea+30_linux-x64_bin.tar.gz
jdk14Path: /jdk-14
archivePortable: tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/JabRef-portable_linux.tar.gz && rm -R build/distribution/JabRef
- os: windows-latest
displayName: windows
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_windows-x64_bin.zip
jpackageDownload: https://download.java.net/java/early_access/jdk14/30/GPL/openjdk-14-ea+30_windows-x64_bin.zip
jdk14Path: /jdk-14
archivePortable: 7z a -r build/distribution/JabRef-portable_windows.zip ./build/distribution/JabRef && rm -R build/distribution/JabRef
- os: macOS-latest
displayName: macOS
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_osx-x64_bin.tar.gz
jpackageDownload: https://download.java.net/java/early_access/jdk14/30/GPL/openjdk-14-ea+30_osx-x64_bin.tar.gz
jdk14Path: /jdk-14.jdk/Contents/Home
archivePortable: brew install pigz && tar -c -C build/distribution JabRef.app | pigz --rsyncable > build/distribution/JabRef-portable_macos.tar.gz && rm -R build/distribution/JabRef.app

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tests-oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Oracle Tests

on:
push:
branches:
- master
# we need to trigger on all branches, because sometimes need copy of branches, because secrets are only available on "internal" pull requests
paths:
- 'src/test/java/org/jabref/model/database/**'
- 'src/test/java/org/jabref/logic/shared/**'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# no generated files in version control
src/main/gen/
src/main/generated/

# private data
/buildres/jabref-cert-2016.p12
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

### Fixed

- We fixed an issue where the Medline fetcher was only working when JabRef was running from source [#5645](https://github.com/JabRef/jabref/issues/5645)
- We fixed some visual issues in the dark theme [#5764](https://github.com/JabRef/jabref/pull/5764) [#5753](https://github.com/JabRef/jabref/issues/5753)
- We fixed an issue where the Medline fetcher was only working when JabRef was running from source. [#5645](https://github.com/JabRef/jabref/issues/5645)
- We fixed some visual issues in the dark theme. [#5764](https://github.com/JabRef/jabref/pull/5764) [#5753](https://github.com/JabRef/jabref/issues/5753)
- We fixed an issue where non-default previews didn't handle unicode characters. [#5779](https://github.com/JabRef/jabref/issues/5779)
- We fixed an issue where the ampersand character wasn't rendering correctly on previews.[#3840](https://github.com/JabRef/jabref/issues/3840)

- We fixed an issue where the ampersand character wasn't rendering correctly on previews. [#3840](https://github.com/JabRef/jabref/issues/3840)
- We fixed an issue where an erroneous "The library has been modified by another program" message was shown when saving. [#4877](https://github.com/JabRef/jabref/issues/4877)
- We fixed an issue where the file extension was missing after downloading a file (we now fall-back to pdf). [#5816](https://github.com/JabRef/jabref/issues/5816)

### Removed

Expand Down
11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ dependencies {
antlr4 'org.antlr:antlr4:4.7.2'
compile 'org.antlr:antlr4-runtime:4.7.2'

compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.2'
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.3'

compile 'org.postgresql:postgresql:42.2.9'

Expand Down Expand Up @@ -169,7 +169,7 @@ dependencies {
compile 'org.controlsfx:controlsfx:11.0.1'

compile 'org.jsoup:jsoup:1.12.1'
compile 'com.konghq:unirest-java:3.3.00'
compile 'com.konghq:unirest-java:3.4.00'

compile 'org.slf4j:slf4j-api:2.0.0-alpha1'
compile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT'
Expand Down Expand Up @@ -206,7 +206,7 @@ dependencies {
}


testCompile 'io.github.classgraph:classgraph:4.8.59'
testCompile 'io.github.classgraph:classgraph:4.8.60'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.5.2'
testCompile 'org.junit.platform:junit-platform-launcher:1.5.2'
Expand All @@ -218,9 +218,8 @@ dependencies {
//testCompile 'com.github.tomakehurst:wiremock:2.24.1'
testCompile 'org.xmlunit:xmlunit-core:2.6.3'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.3'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.12.0'
//testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.11.0'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.12.0'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.13.0'
//testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.13.0'
testCompile "org.testfx:testfx-core:4.0.17-alpha-SNAPSHOT"
testCompile "org.testfx:testfx-junit5:4.0.17-alpha-SNAPSHOT"
testCompile "org.hamcrest:hamcrest-library:2.2"
Expand Down
6 changes: 6 additions & 0 deletions external-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ In case you add a library, please use these identifiers.
For instance, "BSD" is not exact enough, there are numerous variants out there: BSD-2-Clause, BSD-3-Clause-No-Nuclear-Warranty, ...
Note that the SPDX license identifiers are different from the ones used by debian. See https://wiki.debian.org/Proposals/CopyrightFormat for more information.

# bst files

Project: IEEEtran
Path: src/main/resources/bst/IEEEtran.bst
URL: https://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran/bibtex
License: LPPL-1.3

# Fonts and Icons

Expand Down
4 changes: 1 addition & 3 deletions src/jmh/java/org/jabref/benchmarks/Benchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.jabref.logic.layout.format.HTMLChars;
import org.jabref.logic.layout.format.LatexToUnicodeFormatter;
import org.jabref.logic.search.SearchQuery;
import org.jabref.model.Defaults;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.database.BibDatabaseMode;
Expand Down Expand Up @@ -76,8 +75,7 @@ public void init() throws Exception {
private StringWriter getOutputWriter() throws IOException {
StringWriter outputWriter = new StringWriter();
BibtexDatabaseWriter databaseWriter = new BibtexDatabaseWriter(outputWriter, mock(SavePreferences.class), new BibEntryTypesManager());
databaseWriter.savePartOfDatabase(
new BibDatabaseContext(database, new MetaData(), new Defaults()), database.getEntries());
databaseWriter.savePartOfDatabase(new BibDatabaseContext(database, new MetaData()), database.getEntries());
return outputWriter;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/antlr3/org/jabref/bst/Bst.g
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ QUOTED
: '\'' IDENTIFIER;

IDENTIFIER
: LETTER (LETTER|NUMERAL)* ;
: LETTER (LETTER|NUMERAL|'_')* ;

fragment LETTER
: ('a'..'z'|'A'..'Z'|'.'|'$');
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,11 @@
requires org.jsoup;
requires commons.csv;
requires io.github.javadiffutils;
requires java.string.similarity;
requires ojdbc10;
requires org.postgresql.jdbc;
requires org.apache.commons.lang3;
requires org.antlr.antlr4.runtime;
requires flowless;
requires org.apache.tika.core;
}
4 changes: 1 addition & 3 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.jabref.logic.shared.prefs.SharedDatabasePreferences;
import org.jabref.logic.util.OS;
import org.jabref.logic.xmp.XmpPreferences;
import org.jabref.model.Defaults;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.database.BibDatabaseMode;
Expand Down Expand Up @@ -392,8 +391,7 @@ private void saveDatabase(BibDatabase newBase, String subName) {
SavePreferences prefs = Globals.prefs.loadForSaveFromPreferences();
AtomicFileWriter fileWriter = new AtomicFileWriter(Paths.get(subName), prefs.getEncoding());
BibDatabaseWriter databaseWriter = new BibtexDatabaseWriter(fileWriter, prefs, Globals.entryTypesManager);
Defaults defaults = new Defaults(Globals.prefs.getDefaultBibDatabaseMode());
databaseWriter.saveDatabase(new BibDatabaseContext(newBase, defaults));
databaseWriter.saveDatabase(new BibDatabaseContext(newBase));

// Show just a warning message if encoding did not work for all characters:
if (fileWriter.hasEncodingProblems()) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/ClipBoardManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.jabref.Globals;
import org.jabref.logic.bibtex.BibEntryWriter;
import org.jabref.logic.bibtex.LatexFieldFormatter;
import org.jabref.logic.bibtex.FieldWriter;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.ImportException;
import org.jabref.logic.importer.ImportFormatReader;
Expand Down Expand Up @@ -152,7 +152,7 @@ public void setContent(String string) {

public void setContent(List<BibEntry> entries) throws IOException {
final ClipboardContent content = new ClipboardContent();
BibEntryWriter writer = new BibEntryWriter(new LatexFieldFormatter(Globals.prefs.getLatexFieldFormatterPreferences()), Globals.entryTypesManager);
BibEntryWriter writer = new BibEntryWriter(new FieldWriter(Globals.prefs.getFieldWriterPreferences()), Globals.entryTypesManager);
String serializedEntries = writer.serializeAll(entries, BibDatabaseMode.BIBTEX);
content.put(DragAndDropDataFormats.ENTRIES, serializedEntries);
content.putString(serializedEntries);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/jabref/gui/auximport/FromAuxDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.jabref.logic.auxparser.DefaultAuxParser;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.Defaults;
import org.jabref.model.auxparser.AuxParser;
import org.jabref.model.auxparser.AuxParserResult;
import org.jabref.model.database.BibDatabase;
Expand Down Expand Up @@ -59,8 +58,7 @@ public FromAuxDialog(JabRefFrame frame) {
generateButton.defaultButtonProperty().bind(generateButton.disableProperty().not());
setResultConverter(button -> {
if (button == generateButtonType) {
Defaults defaults = new Defaults(Globals.prefs.getDefaultBibDatabaseMode());
BasePanel bp = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), new BibDatabaseContext(auxParserResult.getGeneratedBibDatabase(), defaults), ExternalFileTypes.getInstance());
BasePanel bp = new BasePanel(frame, BasePanelPreferences.from(Globals.prefs), new BibDatabaseContext(auxParserResult.getGeneratedBibDatabase()), ExternalFileTypes.getInstance());
frame.addTab(bp, true);
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/collab/ChangeScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public List<DatabaseChangeViewModel> scanForChanges() {
// Start looking at changes.
BibDatabaseDiff differences = BibDatabaseDiff.compare(database, databaseOnDisk);
differences.getMetaDataDifferences().ifPresent(diff -> {
changes.add(new MetaDataChangeViewModel(diff));
changes.add(new MetaDataChangeViewModel(diff, Globals.prefs));
diff.getGroupDifferences().ifPresent(groupDiff -> changes.add(new GroupChangeViewModel(groupDiff)));
});
differences.getPreambleDifferences().ifPresent(diff -> changes.add(new PreambleChangeViewModel(diff)));
Expand Down Expand Up @@ -82,6 +82,6 @@ private DatabaseChangeViewModel createBibEntryDiff(BibEntryDiff diff) {
return new EntryDeleteChangeViewModel(diff.getOriginalEntry());
}

return new EntryChangeViewModel(diff.getOriginalEntry(), diff.getNewEntry(), database);
return new EntryChangeViewModel(diff.getOriginalEntry(), diff.getNewEntry());
}
}
19 changes: 6 additions & 13 deletions src/main/java/org/jabref/gui/collab/EntryChangeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,21 @@
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

class EntryChangeViewModel extends DatabaseChangeViewModel {

private static final Logger LOGGER = LoggerFactory.getLogger(EntryChangeViewModel.class);

private final BibEntry oldEntry;
private final BibEntry newEntry;
private MergeEntries mergePanel;

private final BibDatabaseContext database;

public EntryChangeViewModel(BibEntry entry, BibEntry newEntry, BibDatabaseContext database) {
public EntryChangeViewModel(BibEntry entry, BibEntry newEntry) {
super();

this.oldEntry = entry;
this.newEntry = newEntry;
this.database = database;

name = entry.getCiteKeyOptional()
.map(key -> Localization.lang("Modified entry") + ": '" + key + '\'')
.orElse(Localization.lang("Modified entry"));

}

/**
Expand All @@ -55,9 +46,11 @@ public void setAccepted(boolean accepted) {
@Override
public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) {
database.getDatabase().removeEntry(oldEntry);
database.getDatabase().insertEntry(mergePanel.getMergeEntry());
BibEntry mergedEntry = mergePanel.getMergeEntry();
mergedEntry.setId(oldEntry.getId()); // Keep ID
database.getDatabase().insertEntry(mergedEntry);
undoEdit.addEdit(new UndoableInsertEntries(database.getDatabase(), oldEntry));
undoEdit.addEdit(new UndoableInsertEntries(database.getDatabase(), mergePanel.getMergeEntry()));
undoEdit.addEdit(new UndoableInsertEntries(database.getDatabase(), mergedEntry));
}

@Override
Expand All @@ -68,7 +61,7 @@ public Node description() {
header.getStyleClass().add("sectionHeader");
container.getChildren().add(header);
container.getChildren().add(mergePanel);
container.setMargin(mergePanel, new Insets(5, 5, 5, 5));
VBox.setMargin(mergePanel, new Insets(5, 5, 5, 5));
return container;
}
}
33 changes: 18 additions & 15 deletions src/main/java/org/jabref/gui/collab/MetaDataChangeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,42 @@

import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;

import org.jabref.gui.undo.NamedCompound;
import org.jabref.logic.bibtex.comparator.MetaDataDiff;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.metadata.MetaData;
import org.jabref.preferences.JabRefPreferences;

class MetaDataChangeViewModel extends DatabaseChangeViewModel {

private final MetaData newMetaData;
private final MetaDataDiff metaDataDiff;
private final JabRefPreferences preferences;

public MetaDataChangeViewModel(MetaDataDiff metaDataDiff) {
public MetaDataChangeViewModel(MetaDataDiff metaDataDiff, JabRefPreferences preferences) {
super(Localization.lang("Metadata change"));
this.newMetaData = metaDataDiff.getNewMetaData();
this.metaDataDiff = metaDataDiff;
this.preferences = preferences;
}

@Override
public Node description() {
VBox container = new VBox(15);

/*
// TODO: Show detailed description of the changes
StringBuilder sb = new StringBuilder(
"<html>" + Localization.lang("Changes have been made to the following metadata elements")
+ ":<p><br>&nbsp;&nbsp;");
sb.append(changes.stream().map(unit -> unit.key).collect(Collectors.joining("<br>&nbsp;&nbsp;")));
sb.append("</html>");
infoPane.setText(sb.toString());
*/
return new Label(Localization.lang("Metadata change"));
Label header = new Label(Localization.lang("The following metadata changed:"));
header.getStyleClass().add("sectionHeader");
container.getChildren().add(header);

for (String change : metaDataDiff.getDifferences(preferences)) {
container.getChildren().add(new Label(change));
}

return container;
}

@Override
public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) {
database.setMetaData(newMetaData);
database.setMetaData(metaDataDiff.getNewMetaData());
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private List<EntryEditorTab> createTabs() {

// Source tab
sourceTab = new SourceTab(databaseContext, undoManager,
entryEditorPreferences.getLatexFieldFormatterPreferences(),
entryEditorPreferences.getFieldWriterPreferences(),
entryEditorPreferences.getImportFormatPreferences(), fileMonitor, dialogService, stateManager, Globals.getKeyPrefs());
entryEditorTabs.add(sourceTab);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import java.util.Set;

import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.logic.bibtex.LatexFieldFormatterPreferences;
import org.jabref.logic.bibtex.FieldWriterPreferences;
import org.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.model.entry.field.Field;

public class EntryEditorPreferences {

private final Map<String, Set<Field>> entryEditorTabList;
private final LatexFieldFormatterPreferences latexFieldFormatterPreferences;
private final FieldWriterPreferences fieldWriterPreferences;
private final ImportFormatPreferences importFormatPreferences;
private final BibtexKeyPatternPreferences bibtexKeyPatternPreferences;
private final List<Field> customTabFieldNames;
Expand All @@ -24,9 +24,9 @@ public class EntryEditorPreferences {
private boolean avoidOverwritingCiteKey;
private final boolean shouldShowLatexCitationsTab;

public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList, LatexFieldFormatterPreferences latexFieldFormatterPreferences, ImportFormatPreferences importFormatPreferences, List<Field> customTabFieldNames, boolean shouldShowRecommendationsTab, boolean isMrdlibAccepted, boolean shouldShowLatexCitationsTab, boolean showSourceTabByDefault, BibtexKeyPatternPreferences bibtexKeyPatternPreferences, KeyBindingRepository keyBindings, boolean avoidOverwritingCiteKey) {
public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList, FieldWriterPreferences fieldWriterPreferences, ImportFormatPreferences importFormatPreferences, List<Field> customTabFieldNames, boolean shouldShowRecommendationsTab, boolean isMrdlibAccepted, boolean shouldShowLatexCitationsTab, boolean showSourceTabByDefault, BibtexKeyPatternPreferences bibtexKeyPatternPreferences, KeyBindingRepository keyBindings, boolean avoidOverwritingCiteKey) {
this.entryEditorTabList = entryEditorTabList;
this.latexFieldFormatterPreferences = latexFieldFormatterPreferences;
this.fieldWriterPreferences = fieldWriterPreferences;
this.importFormatPreferences = importFormatPreferences;
this.customTabFieldNames = customTabFieldNames;
this.shouldShowRecommendationsTab = shouldShowRecommendationsTab;
Expand All @@ -42,8 +42,8 @@ public Map<String, Set<Field>> getEntryEditorTabList() {
return entryEditorTabList;
}

public LatexFieldFormatterPreferences getLatexFieldFormatterPreferences() {
return latexFieldFormatterPreferences;
public FieldWriterPreferences getFieldWriterPreferences() {
return fieldWriterPreferences;
}

public ImportFormatPreferences getImportFormatPreferences() {
Expand Down
Loading

0 comments on commit f5ba88e

Please sign in to comment.