Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into replace_deprecated
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/jabref/gui/JabRefFrame.java
  • Loading branch information
calixtus committed Feb 28, 2020
2 parents 3c7da13 + 9424777 commit 88ca460
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 44 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where changing entry type doesn't always work when biblatex source is shown. [#5905](https://github.com/JabRef/jabref/issues/5905)
- We fixed an issue where the group and the link column were not updated after changing the entry in the main table. [#5985](https://github.com/JabRef/jabref/issues/5985)
- We fixed an issue where reordering the groups was not possible after inserting an article. [#6008](https://github.com/JabRef/jabref/issues/6008)
- We fixed an issue where citation styles except the default "Preview" could not be used. [#56220](https://github.com/JabRef/jabref/issues/5622)

### Removed

- Ampersands are no longer escaped by default in the `bib` file. If you want to keep the current behaviour, you can use the new "Escape Ampersands" formatter as a save action. [#5869](https://github.com/JabRef/jabref/issues/5869)
- The "Merge Entries" entry was removed from the Quality Menu. Users should use the right-click menu instead. [#6021](https://github.com/JabRef/jabref/pull/6021)


## [5.0-beta] – 2019-12-15
Expand Down
12 changes: 5 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ dependencies {
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'

implementation 'de.undercouch:citeproc-java:2.0.0'
implementation 'de.undercouch:citeproc-java:2.1.0-SNAPSHOT'

implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '1.2.1'
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.2'
Expand All @@ -205,7 +205,7 @@ dependencies {
testImplementation 'net.bytebuddy:byte-buddy-parent:1.10.8'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testImplementation 'org.mockito:mockito-core:3.3.0'
testImplementation 'org.mockito:mockito-core:3.3.1'
testImplementation 'org.xmlunit:xmlunit-core:2.6.3'
testImplementation 'org.xmlunit:xmlunit-matchers:2.6.3'
testImplementation 'com.tngtech.archunit:archunit-junit5-api:0.13.1'
Expand Down Expand Up @@ -238,14 +238,12 @@ dependencyUpdates.resolutionStrategy = {
}
}
rules.withModule("org.python:jython-standalone") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.7.2b2/) {
if (selection.candidate.version ==~ /2.7.2b\d/) {
selection.reject('Release candidate')
}
}
rules.withModule("de.jensd:fontawesomefx-materialdesignfont") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.0.26-9.1.2/
|| selection.candidate.version ==~ /2.0.26-9.1.1/
|| selection.candidate.version ==~ /2.0.26-9.1.0/) {
if (selection.candidate.version ==~ /2.0.26.*/) {
selection.reject('1.7.22-11 is actually newer (strange version system)')
}
}
Expand Down Expand Up @@ -546,7 +544,7 @@ task deleteInstallerTemp(type: Delete) {

jpackage.dependsOn deleteInstallerTemp
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
options = ['--strip-debug','--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'JabRef'
}
Expand Down
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ coverage:
- src/gen/.*
status:
patch: false
project:
default:
threshold: 0.005
comment: off
6 changes: 5 additions & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@
requires jbibtex;
requires citeproc.java;
requires antlr.runtime;
requires org.graalvm.js;
requires org.graalvm.truffle;
requires org.graalvm.sdk;
requires transitive org.graalvm.js;
requires java.scripting;
requires jdk.internal.vm.compiler;
requires org.apache.xmpbox;
requires de.saxsys.mvvmfx.validation;
requires com.google.gson;
Expand Down
31 changes: 18 additions & 13 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
import org.jabref.gui.keyboard.KeyBinding;
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;
Expand Down Expand Up @@ -414,7 +413,7 @@ private void initLayout() {

setId("frame");

VBox head = new VBox(createMenu(),createToolbar());
VBox head = new VBox(createMenu(), createToolbar());
head.setSpacing(0d);
setTop(head);

Expand Down Expand Up @@ -690,8 +689,12 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.EXPORT_SELECTED, new ExportCommand(this, true, Globals.prefs)),
factory.createMenuItem(StandardActions.SAVE_SELECTED_AS_PLAIN_BIBTEX, new OldDatabaseCommandWrapper(Actions.SAVE_SELECTED_AS_PLAIN, this, stateManager))),

factory.createMenuItem(StandardActions.CONNECT_TO_SHARED_DB, new ConnectToSharedDatabaseCommand(this)),
factory.createMenuItem(StandardActions.PULL_CHANGES_FROM_SHARED_DB, new OldDatabaseCommandWrapper(Actions.PULL_CHANGES_FROM_SHARED_DATABASE, this, stateManager)),
new SeparatorMenuItem(),

factory.createSubMenu(StandardActions.REMOTE_DB,
factory.createMenuItem(StandardActions.CONNECT_TO_SHARED_DB, new ConnectToSharedDatabaseCommand(this)),
factory.createMenuItem(StandardActions.PULL_CHANGES_FROM_SHARED_DB, new OldDatabaseCommandWrapper(Actions.PULL_CHANGES_FROM_SHARED_DATABASE, this, stateManager))
),

new SeparatorMenuItem(),

Expand Down Expand Up @@ -772,7 +775,16 @@ private MenuBar createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.SET_FILE_LINKS, new AutoLinkFilesAction(this, prefs, stateManager, undoManager, Globals.TASK_EXECUTOR))
factory.createMenuItem(StandardActions.SET_FILE_LINKS, new AutoLinkFilesAction(this, prefs, stateManager, undoManager, Globals.TASK_EXECUTOR)),

new SeparatorMenuItem(),

factory.createSubMenu(StandardActions.ABBREVIATE,
factory.createMenuItem(StandardActions.ABBREVIATE_DEFAULT, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_DEFAULT, this, stateManager)),
factory.createMenuItem(StandardActions.ABBREVIATE_MEDLINE, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_MEDLINE, this, stateManager)),
factory.createMenuItem(StandardActions.ABBREVIATE_SHORTEST_UNIQUE, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_SHORTEST_UNIQUE, this, stateManager))),

factory.createMenuItem(StandardActions.UNABBREVIATE, new OldDatabaseCommandWrapper(Actions.UNABBREVIATE, this, stateManager))
);

lookup.getItems().addAll(
Expand Down Expand Up @@ -802,14 +814,7 @@ private MenuBar createMenu() {
new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.SEND_AS_EMAIL, new SendAsEMailAction(dialogService, stateManager)),
pushToApplicationMenuItem,

factory.createSubMenu(StandardActions.ABBREVIATE,
factory.createMenuItem(StandardActions.ABBREVIATE_DEFAULT, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_DEFAULT, this, stateManager)),
factory.createMenuItem(StandardActions.ABBREVIATE_MEDLINE, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_MEDLINE, this, stateManager)),
factory.createMenuItem(StandardActions.ABBREVIATE_SHORTEST_UNIQUE, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_SHORTEST_UNIQUE, this, stateManager))),

factory.createMenuItem(StandardActions.UNABBREVIATE, new OldDatabaseCommandWrapper(Actions.UNABBREVIATE, this, stateManager))
pushToApplicationMenuItem
);

SidePaneComponent webSearch = sidePaneManager.getComponent(SidePaneType.WEB_SEARCH);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public enum StandardActions implements Action {
IMPORT_INTO_NEW_LIBRARY(Localization.lang("Import into new library"), KeyBinding.IMPORT_INTO_NEW_DATABASE),
IMPORT_INTO_CURRENT_LIBRARY(Localization.lang("Import into current library"), KeyBinding.IMPORT_INTO_CURRENT_DATABASE),
EXPORT_ALL(Localization.lang("Export all entries")),
REMOTE_DB(Localization.lang("Shared database"), IconTheme.JabRefIcons.REMOTE_DATABASE),
EXPORT_SELECTED(Localization.lang("Export selected entries"), KeyBinding.EXPORT_SELECTED),
CONNECT_TO_SHARED_DB(Localization.lang("Connect to shared database"), IconTheme.JabRefIcons.CONNECT_DB),
PULL_CHANGES_FROM_SHARED_DB(Localization.lang("Pull changes from shared database"), KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE),
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ public enum JabRefIcons implements JabRefIcon {
ADD_ABBREVIATION(MaterialDesignIcon.PLAYLIST_PLUS),
REMOVE_ABBREVIATION(MaterialDesignIcon.PLAYLIST_MINUS),
NEW_ENTRY_FROM_PLAIN_TEXT(MaterialDesignIcon.PLUS_BOX),
REMOTE_DATABASE(MaterialDesignIcon.DATABASE),
HOME(MaterialDesignIcon.HOME);

private final JabRefIcon icon;
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/jabref/gui/util/FieldsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import javafx.util.StringConverter;

import org.jabref.Globals;
import org.jabref.gui.specialfields.SpecialFieldViewModel;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
Expand Down Expand Up @@ -30,7 +32,8 @@ public Field fromString(String string) {

public static String getNameWithType(Field field) {
if (field instanceof SpecialField) {
return field.getDisplayName() + " (" + Localization.lang("Special") + ")";
return new SpecialFieldViewModel((SpecialField) field, Globals.undoManager).getLocalization()
+ " (" + Localization.lang("Special") + ")";
} else if (field instanceof IEEEField) {
return field.getDisplayName() + " (" + Localization.lang("IEEE") + ")";
} else if (field instanceof InternalField) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jabref.model.strings.LatexToUnicodeAdapter;

import de.undercouch.citeproc.CSL;
import de.undercouch.citeproc.DefaultAbbreviationProvider;
import de.undercouch.citeproc.ItemDataProvider;
import de.undercouch.citeproc.bibtex.BibTeXConverter;
import de.undercouch.citeproc.csl.CSLItemData;
Expand Down Expand Up @@ -66,7 +67,8 @@ public synchronized List<String> makeBibliography(List<BibEntry> bibEntries, Str
private void initialize(String newStyle, CitationStyleOutputFormat newFormat) throws IOException {
if ((cslInstance == null) || !Objects.equals(newStyle, style)) {
// lang and forceLang are set to the default values of other CSL constructors
cslInstance = new CSL(dataProvider, new JabRefLocaleProvider(), newStyle, "en-US", false);
cslInstance = new CSL(dataProvider, new JabRefLocaleProvider(),
new DefaultAbbreviationProvider(), null, newStyle, "en-US", false, true);
style = newStyle;
}

Expand Down
30 changes: 9 additions & 21 deletions src/main/java/org/jabref/logic/citationstyle/CitationStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemAlreadyExistsException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
Expand All @@ -25,6 +22,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.jabref.JabRefMain;
import org.jabref.logic.util.StandardFileType;

import de.undercouch.citeproc.helper.CSLUtils;
Expand Down Expand Up @@ -138,28 +136,18 @@ public static List<CitationStyle> discoverCitationStyles() {
return STYLES;
}

URL url = CitationStyle.class.getResource(STYLES_ROOT);
if (url == null) {
return Collections.emptyList();
}
URL url = JabRefMain.class.getResource(STYLES_ROOT + "/acm-siggraph.csl");
Objects.requireNonNull(url);

try {
URI uri = url.toURI();
if ("jar".equals(uri.getScheme())) {
try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
Path path = fs.getPath(STYLES_ROOT);
STYLES.addAll(discoverCitationStylesInPath(path));
} catch (FileSystemAlreadyExistsException e) {
try (FileSystem fs = FileSystems.getFileSystem(uri)) {
Path path = fs.getPath(STYLES_ROOT);
STYLES.addAll(discoverCitationStylesInPath(path));
}
}
} else {
STYLES.addAll(discoverCitationStylesInPath(Paths.get(uri)));
}
Path path = Path.of(uri).getParent();

STYLES.addAll(discoverCitationStylesInPath(path));

return STYLES;
} catch (URISyntaxException | IOException e) {
LOGGER.error("something went wrong while searching available CitationStyles. Are you running directly from source code?", e);
LOGGER.error("something went wrong while searching available CitationStyles", e);
return Collections.emptyList();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2114,4 +2114,5 @@ Optional=Optional
Required=Required
Entry\ type\ cannot\ be\ empty.\ Please\ enter\ a\ name.=Entry type cannot be empty. Please enter a name.
Field\ cannot\ be\ empty.\ Please\ enter\ a\ name.=Field cannot be empty. Please enter a name.
Shared\ database=Shared database
Lookup=Lookup

0 comments on commit 88ca460

Please sign in to comment.