Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into jdk9
Browse files Browse the repository at this point in the history
# By Carl Christian Snethlage (33) and others
# Via GitHub (21) and Carl Christian Snethlage (2)
* upstream/master: (103 commits)
  Bump junit-vintage-engine from 5.4.2 to 5.5.0
  Bump log4j-api from 2.11.2 to 2.12.0
  Bump junit-platform-launcher from 1.4.2 to 1.5.0
  Bump log4j-core from 2.11.2 to 2.12.0
  Bump log4j-slf4j18-impl from 2.11.2 to 2.12.0
  Bump log4j-jul from 2.11.2 to 2.12.0
  Bump junit-jupiter from 5.4.2 to 5.5.0
  Bump com.github.johnrengelman.shadow from 5.0.0 to 5.1.0
  Bump log4j-jcl from 2.11.2 to 2.12.0
  Bump fontbox from 2.0.15 to 2.0.16 (#5080)
  Bump pdfbox from 2.0.15 to 2.0.16 (#5081)
  Bump xmpbox from 2.0.15 to 2.0.16 (#5082)
  Update FUNDING.yml
  Delete autoapproval.yml
  Bump com.install4j.gradle from 7.0.11 to 7.0.12 (#5077)
  Configure autoapproval plugin for dependabot
  Bump xmlunit-matchers from 2.6.2 to 2.6.3 (#5074)
  Bump checkstyle from 8.21 to 8.22 (#5072)
  Bump xmlunit-core from 2.6.2 to 2.6.3 (#5073)
  Refactor for loop to stream in groupTree Close version socket
  ...

# Conflicts:
#	build.gradle
  • Loading branch information
Siedlerchr committed Jul 6, 2019
2 parents 11039d8 + a50cb34 commit 666f1f3
Show file tree
Hide file tree
Showing 90 changed files with 2,773 additions and 2,164 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Patreon user account
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: JabRef
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://github.com/JabRef/jabref/wiki/Donations # Replace with a single custom sponsorship URL
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We changed the title of Group Dialog to "Add subgroup" from "Edit group" when we select Add subgroup option.
- We enable import button only if entries are selected. [#4755](https://github.com/JabRef/jabref/issues/4755)
- We made modifications to improve contrast of UI elements. [#4583](https://github.com/JabRef/jabref/issues/4583)
- We added a warning for empty BibTeX keys in the entry editor. [#4440](https://github.com/JabRef/jabref/issues/4440)
- We added an option in the settings to set the default action in JabRef when right clicking on any entry in any database and selecting "Open folder". [#4763](https://github.com/JabRef/jabref/issues/4763)
- The Medline fetcher now normalizes the author names according to the BibTeX-Standard [#4345](https://github.com/JabRef/jabref/issues/4345)
- We added an option on the Linked File Viewer to rename the attached file of an entry directly on the JabRef. [#4844](https://github.com/JabRef/jabref/issues/4844)
- We added an option in the preference dialog box that allows user to enable helpful tooltips.[#3599](https://github.com/JabRef/jabref/issues/3599)
- We moved the dropdown menu for selecting the push-application from the toolbar into the external application preferences. [#674](https://github.com/JabRef/jabref/issues/674)
- We removed the alphabetical ordering of the custom tabs and updated the error message when trying to create a general field with a name containing an illegal character. [#5019](https://github.com/JabRef/jabref/issues/5019)
- We added a context menu to the bib(la)tex-source-editor to copy'n'paste. [#5007](https://github.com/JabRef/jabref/pull/5007)


### Fixed
Expand Down Expand Up @@ -123,7 +127,6 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the JabRef Icon in the macOS launchpad was not displayed correctly [#5003](https://github.com/JabRef/jabref/issues/5003)



### Removed
- The feature to "mark entries" was removed and merged with the groups functionality. For migration, a group is created for every value of the `__markedentry` field and the entry is added to this group.
- The number column was removed.
Expand Down
46 changes: 23 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ buildscript {
plugins {
id 'application'
id 'com.gradle.build-scan' version '2.3'
id 'com.install4j.gradle' version '7.0.11'
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'com.install4j.gradle' version '7.0.12'
id 'com.github.johnrengelman.shadow' version '5.1.0'
// TODO: Modernizer does not yet work with Java 11
//id "com.simonharrer.modernizer" version '1.6.0-1'
id 'me.champeau.gradle.jmh' version '0.4.8'
Expand Down Expand Up @@ -118,14 +118,14 @@ dependencies {
// Include all jar-files in the 'lib' folder as dependencies
compile fileTree(dir: 'lib', includes: ['*.jar'])

compile 'org.apache.pdfbox:pdfbox:2.0.15'
compile 'org.apache.pdfbox:fontbox:2.0.15'
compile 'org.apache.pdfbox:xmpbox:2.0.15'
compile 'org.apache.pdfbox:pdfbox:2.0.16'
compile 'org.apache.pdfbox:fontbox:2.0.16'
compile 'org.apache.pdfbox:xmpbox:2.0.16'

compile group: 'org.apache.tika', name: 'tika-core', version: '1.21'

// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
compile 'org.bouncycastle:bcprov-jdk15on:1.61'
compile 'org.bouncycastle:bcprov-jdk15on:1.62'

compile 'commons-cli:commons-cli:1.4'

Expand All @@ -147,11 +147,11 @@ dependencies {

compile 'mysql:mysql-connector-java:8.0.16'

compile 'org.postgresql:postgresql:42.2.5'
compile 'org.postgresql:postgresql:42.2.6'

compile 'net.java.dev.glazedlists:glazedlists_java15:1.9.1'

compile 'com.google.guava:guava:27.1-jre'
compile 'com.google.guava:guava:28.0-jre'

compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'

Expand All @@ -170,11 +170,12 @@ dependencies {
compile 'org.jsoup:jsoup:1.12.1'
compile 'com.mashape.unirest:unirest-java:1.4.9'

compile 'org.slf4j:slf4j-api:1.8.0-beta4'
compile 'org.apache.logging.log4j:log4j-slf4j18-impl:2.11.2'
compile 'org.apache.logging.log4j:log4j-jcl:2.11.2'
compile 'org.apache.logging.log4j:log4j-api:2.11.2'
compile 'org.apache.logging.log4j:log4j-core:2.11.2'
// >1.8.0-beta is required for java 9 compatibility
compile 'org.slf4j:slf4j-api:2.0.0-alpha0'
compile 'org.apache.logging.log4j:log4j-slf4j18-impl:2.12.0'
compile 'org.apache.logging.log4j:log4j-jcl:2.12.0'
compile 'org.apache.logging.log4j:log4j-api:2.12.0'
compile 'org.apache.logging.log4j:log4j-core:2.12.0'

compile 'de.undercouch:citeproc-java:1.0.1'

Expand All @@ -189,25 +190,24 @@ dependencies {
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.3.1'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.3.1'

testCompile 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.4.2'
testCompile 'org.junit.platform:junit-platform-launcher:1.4.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.0'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.5.0'
testCompile 'org.junit.platform:junit-platform-launcher:1.5.0'

testRuntime 'org.apache.logging.log4j:log4j-core:2.11.1'
testRuntime 'org.apache.logging.log4j:log4j-jul:2.11.2'
testRuntime 'org.apache.logging.log4j:log4j-core:2.12.0'
testRuntime 'org.apache.logging.log4j:log4j-jul:2.12.0'
testCompile 'net.bytebuddy:byte-buddy-parent:1.9.13'
testCompile 'org.mockito:mockito-core:2.28.2'
//testCompile 'com.github.tomakehurst:wiremock:2.23.2'
testCompile 'org.reflections:reflections:0.9.11'
testCompile 'org.xmlunit:xmlunit-core:2.6.2'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.2'
//testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:0.10.2'
testCompile 'org.xmlunit:xmlunit-core:2.6.3'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.3'
//testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.10.2'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.10.2'
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"

checkstyle 'com.puppycrawl.tools:checkstyle:8.21'
checkstyle 'com.puppycrawl.tools:checkstyle:8.22'
xjc 'com.sun.xml.bind:jaxb-xjc:2.2.4-1'
jython 'org.python:jython-standalone:2.7.1'
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/Globals.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref;

import java.awt.GraphicsEnvironment;
import java.io.IOException;
import java.util.Optional;
import java.util.UUID;

Expand All @@ -24,6 +25,7 @@
import org.jabref.preferences.JabRefPreferences;

import com.google.common.base.StandardSystemProperty;
import com.mashape.unirest.http.Unirest;
import com.microsoft.applicationinsights.TelemetryClient;
import com.microsoft.applicationinsights.TelemetryConfiguration;
import com.microsoft.applicationinsights.internal.shutdown.SDKShutdownActivity;
Expand Down Expand Up @@ -125,6 +127,9 @@ public static void shutdownThreadPools() {

public static void stopBackgroundTasks() {
stopTelemetryClient();
try {
Unirest.shutdown();
} catch (IOException ignore) { }
}

public static Optional<TelemetryClient> getTelemetryClient() {
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1028,11 +1028,20 @@ We want to have a look that matches our icons in the tool-bar */
-fx-background-color: -jr-error;
}

.titleHeader {
-fx-font-size: 150%;
-fx-padding: 0em 0em 0.5em 0em;
}

.sectionHeader {
-fx-font-size: 1.5em;
-fx-padding: 1em 0em 1em 0em;
-fx-font-size: 130%;
-fx-padding: 1em 0em 0.2em 0em;
}

.dialog-pane {
-fx-background-color: -fx-control-inner-background;
}

.preference-sidepane {
-fx-background-color: -jr-sidepane-background;
}
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,9 @@ public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabas

this.getDatabase().registerListener(new UpdateTimestampListener(Globals.prefs));

this.entryEditor = new EntryEditor(this, preferences.getEntryEditorPreferences(), Globals.getFileUpdateMonitor(), dialogService, externalFileTypes, Globals.TASK_EXECUTOR);
this.entryEditor = new EntryEditor(this, preferences.getEntryEditorPreferences(), Globals.getFileUpdateMonitor(), dialogService, externalFileTypes, Globals.TASK_EXECUTOR, Globals.stateManager);

this.preview = new PreviewPanel(getBibDatabaseContext(), this, dialogService, externalFileTypes, Globals.getKeyPrefs(), preferences.getPreviewPreferences());
frame().getGlobalSearchBar().getSearchQueryHighlightObservable().addSearchListener(preview);
}

@Subscribe
Expand Down
86 changes: 50 additions & 36 deletions src/main/java/org/jabref/gui/ClipBoardManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.jabref.gui;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -28,13 +30,11 @@
import org.slf4j.LoggerFactory;

public class ClipBoardManager {

public static final DataFormat XML = new DataFormat("application/xml");

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

private final Clipboard clipboard;

private final ImportFormatReader importFormatReader;

public ClipBoardManager() {
Expand Down Expand Up @@ -63,9 +63,8 @@ public String getContents() {
String result = clipboard.getString();
if (result == null) {
return "";
} else {
return result;
}
return result;
}

public void setHtmlContent(String html) {
Expand All @@ -89,40 +88,55 @@ public void setContent(List<BibEntry> entries) throws IOException {
clipboard.setContent(content);
}

public List<BibEntry> extractEntries() {
public List<BibEntry> extractData() {
Object entries = clipboard.getContent(DragAndDropDataFormats.ENTRIES);

if (entries == null) {
return handleStringData(clipboard.getString());
}
return handleBibTeXData((String) entries);
}

private List<BibEntry> handleBibTeXData(String entries) {
BibtexParser parser = new BibtexParser(Globals.prefs.getImportFormatPreferences(), Globals.getFileUpdateMonitor());
if (entries != null) {
// We have determined that the clipboard data is a set of entries (serialized as a string).
try {
return parser.parseEntries((String) entries);
} catch (ParseException ex) {
LOGGER.error("Could not paste", ex);
}
} else {
String data = clipboard.getString();
if (data != null) {
try {
// fetch from doi
Optional<DOI> doi = DOI.parse(data);
if (doi.isPresent()) {
LOGGER.info("Found DOI in clipboard");
Optional<BibEntry> entry = new DoiFetcher(Globals.prefs.getImportFormatPreferences()).performSearchById(doi.get().getDOI());
return OptionalUtil.toList(entry);
} else {
try {
UnknownFormatImport unknownFormatImport = importFormatReader.importUnknownFormat(data);
return unknownFormatImport.parserResult.getDatabase().getEntries();
} catch (ImportException e) {
// import failed and result will be empty
}
}
} catch (FetcherException ex) {
LOGGER.error("Error while fetching", ex);
}
}
try {
return parser.parseEntries(new ByteArrayInputStream(entries.getBytes(StandardCharsets.UTF_8)));
} catch (ParseException ex) {
LOGGER.error("Could not paste", ex);
return Collections.emptyList();
}
}

private List<BibEntry> handleStringData(String data) {
if (data == null || data.isEmpty()) {
return Collections.emptyList();
}

Optional<DOI> doi = DOI.parse(data);
if (doi.isPresent()) {
return fetchByDOI(doi.get());
}

return tryImportFormats(data);
}

private List<BibEntry> tryImportFormats(String data) {
try {
UnknownFormatImport unknownFormatImport = importFormatReader.importUnknownFormat(data);
return unknownFormatImport.parserResult.getDatabase().getEntries();
} catch (ImportException ignored) {
return Collections.emptyList();
}
}

private List<BibEntry> fetchByDOI(DOI doi) {
LOGGER.info("Found DOI in clipboard");
try {
Optional<BibEntry> entry = new DoiFetcher(Globals.prefs.getImportFormatPreferences()).performSearchById(doi.getDOI());
return OptionalUtil.toList(entry);
} catch (FetcherException ex) {
LOGGER.error("Error while fetching", ex);
return Collections.emptyList();
}
return Collections.emptyList();
}
}
Loading

0 comments on commit 666f1f3

Please sign in to comment.