Skip to content

Commit

Permalink
Merge branch 'master' into menu_select_push_app
Browse files Browse the repository at this point in the history
  • Loading branch information
calixtus committed May 27, 2019
2 parents 0b71535 + 0a4210e commit 236aefb
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 76 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,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
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1032,3 +1032,7 @@ We want to have a look that matches our icons in the tool-bar */
-fx-font-size: 1.5em;
-fx-padding: 1em 0em 1em 0em;
}

.dialog-pane {
-fx-background-color: -fx-control-inner-background;
}
9 changes: 2 additions & 7 deletions src/main/java/org/jabref/gui/actions/ActionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.lang.reflect.Method;
import java.util.Objects;

import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBase;
import javafx.scene.control.CheckMenuItem;
Expand Down Expand Up @@ -157,13 +156,9 @@ public ButtonBase configureIconButton(Action action, Command command, ButtonBase
button.getStyleClass().add("icon-button");

// For some reason the graphic is not set correctly, so let's fix this
// ToDO: Find a way to reuse JabRefIconView
button.graphicProperty().unbind();
action.getIcon().ifPresent(icon -> {
// ToDO: Find a way to reuse JabRefIconView
Node graphicNode = icon.getGraphicNode();
graphicNode.setStyle(String.format("-fx-font-family: %s; -fx-font-size: %s;", icon.fontFamily(), "1em"));
button.setGraphic(graphicNode);
});
action.getIcon().ifPresent(icon -> button.setGraphic(icon.getGraphicNode()));

return button;
}
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
<Tooltip text="%Change entry type"/>
</tooltip>
</Button>
<Button fx:id="generateCiteKeyButton" styleClass="narrow"/>
<Button styleClass="icon-button,narrow" onAction="#generateCiteKeyButton">
<graphic>
<JabRefIconView glyph="MAKE_KEY"/>
</graphic>
<tooltip>
<Tooltip text="%Generate BibTeX key"/>
</tooltip>
</Button>
<Button fx:id="fetcherButton" styleClass="icon-button,narrow">
<graphic>
<JabRefIconView glyph="REFRESH"/>
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import org.jabref.gui.BasePanel;
import org.jabref.gui.DialogService;
import org.jabref.gui.GUIGlobals;
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.bibtexkeypattern.GenerateBibtexKeySingleAction;
import org.jabref.gui.entryeditor.fileannotationtab.FileAnnotationTab;
import org.jabref.gui.externalfiles.ExternalFilesEntryLinker;
Expand Down Expand Up @@ -87,7 +85,6 @@ public class EntryEditor extends BorderPane {
@FXML private Button typeChangeButton;
@FXML private Button fetcherButton;
@FXML private Label typeLabel;
@FXML private Button generateCiteKeyButton;

private final EntryEditorPreferences preferences;
private final DialogService dialogService;
Expand Down Expand Up @@ -261,6 +258,12 @@ private void deleteEntry() {
panel.delete(entry);
}

@FXML
void generateCiteKeyButton() {
GenerateBibtexKeySingleAction action = new GenerateBibtexKeySingleAction(getEntry(), databaseContext, dialogService, preferences, undoManager);
action.execute();
}

@FXML
private void navigateToPreviousEntry() {
panel.selectPreviousEntry();
Expand Down Expand Up @@ -387,13 +390,6 @@ private void setupToolBar() {
fetcherMenu.getItems().add(fetcherMenuItem);
}
fetcherButton.setOnMouseClicked(event -> fetcherMenu.show(fetcherButton, Side.RIGHT, 0, 0));

// Configure cite key button
new ActionFactory(preferences.getKeyBindings())
.configureIconButton(
StandardActions.GENERATE_CITE_KEY,
new GenerateBibtexKeySingleAction(getEntry(), databaseContext, dialogService, preferences, undoManager),
generateCiteKeyButton);
}

private void fetchAndMerge(EntryBasedFetcher fetcher) {
Expand Down
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
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/gui/help/AboutDialog.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.about-heading {
-fx-font-size: 30;
-fx-text-fill: -jr-theme;
}

.about-heading:pressed {
-fx-text-fill: -fx-focus-color;
-fx-text-fill: -jr-selected;
}

.top-padding {
Expand Down Expand Up @@ -33,7 +34,7 @@
}

.info-sections {
-fx-padding: 5px;
-fx-padding: 5px;
}

.logo-pane {
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
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#sideMenu {
-fx-background-color: -jr-white;
-fx-background-color: -fx-control-inner-background;
-fx-border-color: -fx-outer-border;
-fx-border-width: 1;
}

#sideMenu > .virtual-flow > .clipped-container > .sheet > .list-cell {
-fx-padding: 8 8 8 8;
-fx-background: -jr-white;
-fx-background: -fx-control-inner-background;
}

.preferencePaneContainer {
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.
Loading

0 comments on commit 236aefb

Please sign in to comment.