Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into convertSearchWorker
Browse files Browse the repository at this point in the history
* upstream/master:
  Update mac icon and install4j to 7.0.11 (#5005)
  Bump checkstyle from 8.20 to 8.21 (#5001)
  fix IEE fetcher (#4999)
  Fix the 'Attach file' dialog for starting on the user's main directory (#4996)
  Readme TOC (#4986)
  • Loading branch information
Siedlerchr committed May 27, 2019
2 parents 63678c2 + 0a4210e commit 1c675db
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 54 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the RIS import would overwite the article date with the value of the acessed date [#4816](https://github.com/JabRef/jabref/issues/4816)
- We fixed an issue where an NullPointer exception was thrown when a referenced entry in an Open/Libre Office document was no longer present in the library. Now an error message with the reference marker of the missing entry is shown. [#4932](https://github.com/JabRef/jabref/issues/4932)
- We fixed an issue where a database exception related to a missing timezone was too big. [#4827](https://github.com/JabRef/jabref/issues/4827)
- We fixed an issue where the IEEE fetcher returned an error if no keywords were present in the result from the IEEE website [#4997](https://github.com/JabRef/jabref/issues/4997)
- We fixed an issue where the command line help text had several errors, and arguments and descriptions have been rewritten to simplify and detail them better. [#4932](https://github.com/JabRef/jabref/issues/2016)
- We fixed an issue where the same menu for changing entry type had two different sizes and weights. [#4977](https://github.com/JabRef/jabref/issues/4977)
- We fixed an issue where the "Attach file" dialog, in the right-click menu for an entry, started on the working directory instead of the user's main directory. [#4995](https://github.com/JabRef/jabref/issues/4995)
- 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
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ JabRef is an open-source, cross-platform citation and reference management tool
Stay on top of your literature: JabRef helps you to collect and organize sources, find the paper you need and discover the latest research.
![main table](https://www.jabref.org/img/JabRef-4-0-MainTable.png)

## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Bug Reports, Suggestions, Other Feedback](#bug-reports-suggestions-other-feedback)
- [Contributing](#contributing)
- [Acknowledgements](#acknowledgements) / [License](#license)

## Features

JabRef is a cross-platform application that works on Windows, Linux and Mac OS X. It is available free of charge and is actively developed.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ dependencies {
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"

checkstyle 'com.puppycrawl.tools:checkstyle:8.20'
checkstyle 'com.puppycrawl.tools:checkstyle:8.21'
xjc 'com.sun.xml.bind:jaxb-xjc:2.2.4-1'
jython 'org.python:jython-standalone:2.7.1'
}
Expand Down
2 changes: 1 addition & 1 deletion jabref.install4j
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<install4j version="7.0.8" transformSequenceNumber="7">
<install4j version="7.0.11" transformSequenceNumber="7">
<directoryPresets config="./buildres/jabref.json" />
<application name="JabRef" distributionSourceDir="" applicationId="0034-7691-1464-4754" mediaDir="build/install4j" mediaFilePattern="${compiler:sys.shortName}_${compiler:sys.platform}_${compiler:sys.version}" compression="6" lzmaCompression="false" pack200Compression="false" excludeSignedFromPacking="true" commonExternalFiles="false" createMd5Sums="true" shrinkRuntime="true" shortName="JabRef" publisher="JabRef Community" publisherWeb="https://www.jabref.org/" version="DEV" allPathsRelative="true" backupOnSave="false" autoSave="true" convertDotsToUnderscores="true" macSignature="????" macVolumeId="780dfea2d33a0244" javaMinVersion="1.8" javaMaxVersion="1.8" allowBetaVM="false" jdkMode="runtimeJre" jdkName="">
<languages skipLanguageSelection="true" languageSelectionInPrincipalLanguage="false">
Expand Down
2 changes: 1 addition & 1 deletion scripts/download-install4j-and-jres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ ! -d ~/downloads ]; then
mkdir ~/downloads
fi
cd ~/downloads
wget --quiet -nc --show-progress http://download-keycdn.ej-technologies.com/install4j/install4j_unix_7_0_8.tar.gz
wget --quiet -nc --show-progress http://download-keycdn.ej-technologies.com/install4j/install4j_unix_7_0_11.tar.gz

# fetch JREs
if [ ! -d ~/.install4j7/jres ]; then
Expand Down
4 changes: 2 additions & 2 deletions scripts/extract-install4j.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
tar -xf ~/downloads/install4j_unix_7_0_8.tar.gz
tar -xf ~/downloads/install4j_unix_7_0_11.tar.gz
# fix directory name (until install4j 6.1.5 it was install4j6
mv install4j7.0.8 install4j7
mv install4j7.0.11 install4j7
17 changes: 13 additions & 4 deletions src/main/java/org/jabref/gui/filelist/AttachFileAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.jabref.gui.filelist;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;

import org.jabref.Globals;
Expand Down Expand Up @@ -32,14 +34,21 @@ public void execute() {
dialogService.notify(Localization.lang("This operation requires exactly one item to be selected."));
return;
}

BibEntry entry = panel.getSelectedEntries().get(0);

Path workingDirectory = panel.getBibDatabaseContext()
.getFirstExistingFileDir(Globals.prefs.getFilePreferences())
.orElse(Paths.get(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)));

FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder()
.withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY))
.build();
.withInitialDirectory(workingDirectory)
.build();

dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(newFile -> {

LinkedFile linkedFile = LinkedFilesEditorViewModel.fromFile(newFile, panel.getBibDatabaseContext().getFileDirectoriesAsPaths(Globals.prefs.getFilePreferences()), ExternalFileTypes.getInstance());
LinkedFile linkedFile = LinkedFilesEditorViewModel.fromFile(newFile,
panel.getBibDatabaseContext().getFileDirectoriesAsPaths(Globals.prefs.getFilePreferences()),
ExternalFileTypes.getInstance());

LinkedFileEditDialogView dialog = new LinkedFileEditDialogView(linkedFile);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class WebSearchPane extends SidePaneComponent {
public WebSearchPane(SidePaneManager sidePaneManager, JabRefPreferences preferences, JabRefFrame frame) {
super(sidePaneManager, IconTheme.JabRefIcons.WWW, Localization.lang("Web search"));
this.preferences = preferences;
this.viewModel = new WebSearchPaneViewModel(preferences.getImportFormatPreferences(), frame, preferences);
this.viewModel = new WebSearchPaneViewModel(preferences.getImportFormatPreferences(), frame, preferences, frame.getDialogService());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

import org.jabref.gui.DialogService;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.importer.ImportEntriesDialog;
import org.jabref.gui.util.BackgroundTask;
Expand All @@ -25,21 +26,19 @@
import org.jabref.preferences.JabRefPreferences;

import org.fxmisc.easybind.EasyBind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WebSearchPaneViewModel {

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

private final ObjectProperty<SearchBasedFetcher> selectedFetcher = new SimpleObjectProperty<>();
private final ListProperty<SearchBasedFetcher> fetchers = new SimpleListProperty<>(FXCollections.observableArrayList());
private final StringProperty query = new SimpleStringProperty();
private final JabRefFrame frame;
private final DialogService dialogService;

public WebSearchPaneViewModel(ImportFormatPreferences importPreferences, JabRefFrame frame, JabRefPreferences preferences) {
public WebSearchPaneViewModel(ImportFormatPreferences importPreferences, JabRefFrame frame, JabRefPreferences preferences, DialogService dialogService) {
// TODO: Rework so that we don't rely on JabRefFrame and not the complete preferences
this.frame = frame;
this.dialogService = dialogService;

List<SearchBasedFetcher> allFetchers = WebFetchers.getSearchBasedFetchers(importPreferences);
allFetchers.sort(Comparator.comparing(WebFetcher::getName));
Expand Down Expand Up @@ -84,12 +83,12 @@ public StringProperty queryProperty() {

public void search() {
if (StringUtil.isBlank(getQuery())) {
frame.getDialogService().notify(Localization.lang("Please enter a search string"));
dialogService.notify(Localization.lang("Please enter a search string"));
return;
}

if (frame.getCurrentBasePanel() == null) {
frame.getDialogService().notify(Localization.lang("Please open or start a new library before searching"));
dialogService.notify(Localization.lang("Please open or start a new library before searching"));
return;
}

Expand All @@ -98,6 +97,8 @@ public void search() {
BackgroundTask<List<BibEntry>> task = BackgroundTask.wrap(() -> activeFetcher.performSearch(getQuery().trim()))
.withInitialMessage(Localization.lang("Processing %0", getQuery()));

task.onFailure(ex -> dialogService.showErrorDialogAndWait(ex));

ImportEntriesDialog dialog = new ImportEntriesDialog(frame.getCurrentBasePanel().getBibDatabaseContext(), task);
dialog.setTitle(activeFetcher.getName());
dialog.showAndWait();
Expand Down
27 changes: 15 additions & 12 deletions src/main/java/org/jabref/logic/importer/fetcher/IEEE.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,28 @@ private static BibEntry parseJsonRespone(JSONObject jsonEntry, Character keyword
final List<String> authors = new ArrayList<>();
JSONObject authorsContainer = jsonEntry.optJSONObject("authors");
authorsContainer.getJSONArray("authors").forEach(authorPure -> {
JSONObject author = (JSONObject) authorPure;
authors.add(author.optString("full_name"));
}
);
JSONObject author = (JSONObject) authorPure;
authors.add(author.optString("full_name"));
});
entry.setField(FieldName.AUTHOR, authors.stream().collect(Collectors.joining(" and ")));
entry.setField(FieldName.LOCATION, jsonEntry.optString("conference_location"));
entry.setField(FieldName.DOI, jsonEntry.optString("doi"));
entry.setField(FieldName.PAGES, jsonEntry.optString("start_page") + "--" + jsonEntry.optString("end_page"));

JSONObject keywordsContainer = jsonEntry.optJSONObject("index_terms");
if (keywordsContainer != null) {
keywordsContainer.getJSONObject("ieee_terms").getJSONArray("terms").forEach(data -> {
String keyword = (String) data;
entry.addKeyword(keyword, keywordSeparator);
});
keywordsContainer.getJSONObject("author_terms").getJSONArray("terms").forEach(data -> {
String keyword = (String) data;
entry.addKeyword(keyword, keywordSeparator);
});
if (keywordsContainer.has("ieee_terms")) {
keywordsContainer.getJSONObject("ieee_terms").getJSONArray("terms").forEach(data -> {
String keyword = (String) data;
entry.addKeyword(keyword, keywordSeparator);
});
}
if (keywordsContainer.has("author_terms")) {
keywordsContainer.getJSONObject("author_terms").getJSONArray("terms").forEach(data -> {
String keyword = (String) data;
entry.addKeyword(keyword, keywordSeparator);
});
}
}

entry.setField(FieldName.ISBN, jsonEntry.optString("isbn"));
Expand Down
Binary file modified src/main/resources/icons/jabref.icns
Binary file not shown.
66 changes: 41 additions & 25 deletions src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import java.util.List;
import java.util.Optional;

import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibtexEntryTypes;
import org.jabref.model.entry.FieldName;
import org.jabref.support.DisabledOnCIServer;
import org.jabref.testutils.category.FetcherTest;

Expand Down Expand Up @@ -38,50 +40,40 @@ void setUp() {
void findByDOI() throws IOException {
entry.setField("doi", "10.1109/ACCESS.2016.2535486");

assertEquals(
Optional.of(
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
fetcher.findFullText(entry));
assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")),
fetcher.findFullText(entry));
}

@Test
void findByDocumentUrl() throws IOException {
entry.setField("url", "https://ieeexplore.ieee.org/document/7421926/");
assertEquals(
Optional.of(
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
fetcher.findFullText(entry));
assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")),
fetcher.findFullText(entry));
}

@Test
void findByURL() throws IOException {
entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7421926");
entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7421926&ref=");

assertEquals(
Optional.of(
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
fetcher.findFullText(entry));
assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")),
fetcher.findFullText(entry));
}

@Test
void findByOldURL() throws IOException {
entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7421926");

assertEquals(
Optional.of(
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
fetcher.findFullText(entry));
assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")),
fetcher.findFullText(entry));
}

@Test
void findByDOIButNotURL() throws IOException {
entry.setField("doi", "10.1109/ACCESS.2016.2535486");
entry.setField("url", "http://dx.doi.org/10.1109/ACCESS.2016.2535486");

assertEquals(
Optional.of(
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
fetcher.findFullText(entry));
assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")),
fetcher.findFullText(entry));
}

@Test
Expand All @@ -99,23 +91,47 @@ void notFoundByDOI() throws IOException {
assertEquals(Optional.empty(), fetcher.findFullText(entry));
}

@Test
void searchResultHasNoKeywordTerms() throws FetcherException {
BibEntry expected = new BibEntry(BibtexEntryTypes.ARTICLE);

expected.setField("author", "Shatakshi Jha and Ikhlaq Hussain and Bhim Singh and Sukumar Mishra");
expected.setField("date", "25 2 2019");
expected.setField("doi", "10.1049/iet-rpg.2018.5648");
expected.setField("file", ":https\\://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8636659:PDF");
expected.setField("issn", "1752-1416");
expected.setField("issue", "3");
expected.setField("journaltitle", "IET Renewable Power Generation");
expected.setField("pages", "418--426");
expected.setField("publisher", "IET");
expected.setField("title", "Optimal operation of PV-DG-battery based microgrid with power quality conditioner");
expected.setField("volume", "13");

List<BibEntry> fetchedEntries = fetcher.performSearch("8636659"); //article number
fetchedEntries.stream().forEach(entry -> entry.clearField(FieldName.ABSTRACT)); //Remove abstract due to copyright);
assertEquals(Collections.singletonList(expected), fetchedEntries);

}

@Test
void searchByQueryFindsEntry() throws Exception {
BibEntry expected = new BibEntry(BibtexEntryTypes.INPROCEEDINGS);
expected.setField("author", "Igor Steinmacher and Tayana Uchoa Conte and Christoph Treude and Marco Aurélio Gerosa");
expected.setField("date", "14-22 May 2016");
expected.setField("eventdate", "14-22 May 2016");
expected.setField("eventtitleaddon", "Austin, TX");
expected.setField("location", "Austin, TX");
expected.setField("doi", "10.1145/2884781.2884806");
expected.setField("isbn", "New-2005_Electronic_978-1-4503-3900-1");
expected.setField("isbn", "978-1-4503-3900-1");
expected.setField("issn", "1558-1225");
expected.setField("journaltitle", "2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE)");
expected.setField("pages", "273--284");
expected.setField("publisher", "IEEE");
expected.setField("keywords", "Computer bugs, Documentation, Industries, Joining processes, Open source software, Portals, Barriers, Beginners, Joining Process, Newbies, Newcomers, Novices, Obstacles, Onboarding, Open Source Software");
expected.setField("keywords", "Portals, Documentation, Computer bugs, Joining processes, Industries, Open source software, Newcomers, Newbies, Novices, Beginners, Open Source Software, Barriers, Obstacles, Onboarding, Joining Process");
expected.setField("title", "Overcoming Open Source Project Entry Barriers with a Portal for Newcomers");
expected.setField("file", ":https\\://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7886910:PDF");
expected.setField("file", ":https\\://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7886910:PDF");
expected.setField("abstract", "Community-based Open Source Software (OSS) projects are usually self-organized and dynamic, receiving contributions from distributed volunteers. Newcomer are important to the survival, long-term success, and continuity of these communities. However, newcomers face many barriers when making their first contribution to an OSS project, leading in many cases to dropouts. Therefore, a major challenge for OSS projects is to provide ways to support newcomers during their first contribution. In this paper, we propose and evaluate FLOSScoach, a portal created to support newcomers to OSS projects. FLOSScoach was designed based on a conceptual model of barriers created in our previous work. To evaluate the portal, we conducted a study with 65 students, relying on qualitative data from diaries, self-efficacy questionnaires, and the Technology Acceptance Model. The results indicate that FLOSScoach played an important role in guiding newcomers and in lowering barriers related to the orientation and contribution process, whereas it was not effective in lowering technical barriers. We also found that FLOSScoach is useful, easy to use, and increased newcomers' confidence to contribute. Our results can help project maintainers on deciding the points that need more attention in order to help OSS project newcomers overcome entry barriers.");
List<BibEntry> fetchedEntries = fetcher.performSearch("JabRef Social Barriers Steinmacher Redmiles Austin");
List<BibEntry> fetchedEntries = fetcher.performSearch("Overcoming Open Source Project Entry Barriers with a Portal for Newcomers");
assertEquals(Collections.singletonList(expected), fetchedEntries);
}
}

0 comments on commit 1c675db

Please sign in to comment.