Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sortStrings
Browse files Browse the repository at this point in the history
* upstream/master:
  Try to update to gradle 5.0.2 (#4766)
  Post change notifications on JavaFX (#4871)
  fix missing l10n from previous merge
  fix compile error
  Fix right clicking on any entry and selecting "Open folder" results in the NullPointer exception (#4797)
  Bump fontbox from 2.0.14 to 2.0.15 (#4882)
  Bump pdfbox from 2.0.14 to 2.0.15 (#4881)
  Bump xmpbox from 2.0.14 to 2.0.15 (#4883)

# Conflicts:
#	src/main/resources/l10n/JabRef_en.properties
  • Loading branch information
Siedlerchr committed Apr 14, 2019
2 parents 2bb6fe8 + 7a190c9 commit 3dfdf20
Show file tree
Hide file tree
Showing 15 changed files with 192 additions and 59 deletions.
3 changes: 2 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ Johannes Manner <johannes.manner@web.de>
Dominik Traczyk <dominik646@gmail.com>
Cerrianne Santos <cerrianne.santos@gmail.com>
Stefan Scheffel <st155160@stud.uni-stuttgart.de>
Stefan Gerzmann <steppery@gmx.de>
Stefan Gerzmann <steppery@gmx.de>
Deepak Kumar <deepakkumar24196@gmail.com>
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ 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 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)


Expand Down Expand Up @@ -105,13 +106,14 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where only one PDF file could be imported [#4422](https://github.com/JabRef/jabref/issues/4422)
- We fixed an issue where "Move to group" would always move the first entry in the library and not the selected [#4414](https://github.com/JabRef/jabref/issues/4414)
- We fixed an issue where an older dialog appears when downloading full texts from the quality menu. [#4489](https://github.com/JabRef/jabref/issues/4489)
- We fixed an issue where right clicking on any entry in any database and selecting "Open folder" results in the NullPointer exception. [#4763](https://github.com/JabRef/jabref/issues/4763)
- We fixed an issue where option 'open terminal here' with custom command was passing wrong argument. [#4802](https://github.com/JabRef/jabref/issues/4802)
- We fixed an issue where ranking an entry would generate an IllegalArgumentException. [#4754](https://github.com/JabRef/jabref/issues/4754)
- We fixed an issue where special characters where removed from non label key generation pattern parts [#4767](https://github.com/JabRef/jabref/issues/4767)
- 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)




### 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
33 changes: 15 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@ buildscript {
}

plugins {
id 'com.gradle.build-scan' version '1.16'
id 'com.install4j.gradle' version '7.0.9'
id 'com.github.johnrengelman.shadow' version '4.0.2'
id 'com.gradle.build-scan' version '2.0.2'
id 'com.install4j.gradle' version '7.0.10'
id 'com.github.johnrengelman.shadow' version '5.0.0'
id "com.simonharrer.modernizer" version '1.6.0-1'
id 'me.champeau.gradle.jmh' version '0.4.8'
id 'net.ltgt.errorprone' version '0.6.1'
id 'com.github.ben-manes.versions' version '0.20.0'
id 'net.ltgt.errorprone' version '0.7.1'
id 'com.github.ben-manes.versions' version '0.21.0'
}

// use the gradle build scan feature: https://scans.gradle.com/get-started
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}
buildScan { termsOfServiceUrl = 'https://gradle.com/terms-of-service'; termsOfServiceAgree = 'yes' }


apply plugin: 'java'
apply plugin: 'application'
Expand Down Expand Up @@ -95,9 +93,9 @@ dependencies {
compile 'com.jgoodies:jgoodies-common:1.8.1'
compile 'com.jgoodies:jgoodies-forms:1.9.0'

compile 'org.apache.pdfbox:pdfbox:2.0.14'
compile 'org.apache.pdfbox:fontbox:2.0.14'
compile 'org.apache.pdfbox:xmpbox:2.0.14'
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 group: 'org.apache.tika', name: 'tika-core', version: '1.20'

Expand Down Expand Up @@ -129,9 +127,10 @@ dependencies {
compile 'com.google.guava:guava:27.1-jre'

// JavaFX stuff
compile 'de.jensd:fontawesomefx-commons:8.15'
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4'
compile 'de.saxsys:mvvmfx-validation:1.8.0'
compile 'de.saxsys:mvvmfx:1.7.0'
compile 'de.saxsys:mvvmfx:1.8.0'
compile 'org.fxmisc.easybind:easybind:1.0.3'
compile 'org.fxmisc.flowless:flowless:0.6.1'
compile 'org.fxmisc.richtext:richtextfx:0.9.3'
Expand Down Expand Up @@ -196,11 +195,6 @@ dependencyUpdates.resolutionStrategy = {
selection.reject("Ignore SNAPSHOT releases")
}
}
rules.withModule("com.gradle.build-scan:com.gradle.build-scan.gradle.plugin") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.*/) {
selection.reject("Cannot be upgraded to version 2 until we upgrade to gradle 5")
}
}
rules.withModule("org.controlsfx:controlsfx") { ComponentSelection selection ->
if (selection.candidate.version ==~ /9.*/) { // Reject version 9 or higher
selection.reject("Cannot be updated to 9.*.* until Jabref works with Java 9")
Expand Down Expand Up @@ -322,11 +316,14 @@ task generateSearchGrammarSource(type: JavaExec) {
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:none"
//ignore annotation processor from log4j2
options.compilerArgs += '-proc:none'
}
compileJava.dependsOn "generateSource"

compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs += '-proc:none'
}

javadoc {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void output(String s) {

private void setupActions() {
SaveDatabaseAction saveAction = new SaveDatabaseAction(this, Globals.prefs);
CleanupAction cleanUpAction = new CleanupAction(this, Globals.prefs);
CleanupAction cleanUpAction = new CleanupAction(this, Globals.prefs, Globals.TASK_EXECUTOR);

actions.put(Actions.UNDO, undoAction);
actions.put(Actions.REDO, redoAction);
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/org/jabref/gui/actions/CleanupAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.jabref.gui.cleanup.CleanupDialog;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableFieldChange;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.logic.cleanup.CleanupPreset;
import org.jabref.logic.cleanup.CleanupWorker;
import org.jabref.logic.l10n.Localization;
Expand All @@ -20,15 +22,17 @@ public class CleanupAction implements BaseAction {

private final BasePanel panel;
private final DialogService dialogService;
private final TaskExecutor taskExecutor;

private boolean isCanceled;
private int modifiedEntriesCount;
private final JabRefPreferences preferences;

public CleanupAction(BasePanel panel, JabRefPreferences preferences) {
public CleanupAction(BasePanel panel, JabRefPreferences preferences, TaskExecutor taskExecutor) {
this.panel = panel;
this.preferences = preferences;
this.dialogService = panel.frame().getDialogService();
this.taskExecutor = taskExecutor;
}

@Override
Expand Down Expand Up @@ -58,8 +62,9 @@ public void action() {

preferences.setCleanupPreset(chosenPreset.get());

this.cleanup(chosenPreset.get());
this.showResults();
BackgroundTask.wrap(() -> cleanup(chosenPreset.get()))
.onSuccess(result -> showResults())
.executeWith(taskExecutor);
}
}

Expand Down
41 changes: 32 additions & 9 deletions src/main/java/org/jabref/gui/desktop/JabRefDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,33 @@ private static void openExternalFilePlatformIndependent(Optional<ExternalFileTyp
* @throws IOException
*/
public static void openFolderAndSelectFile(Path fileLink) throws IOException {
NATIVE_DESKTOP.openFolderAndSelectFile(fileLink);
if (fileLink == null) {
return;
}
boolean usingDefault = Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION);

if (usingDefault) {
NATIVE_DESKTOP.openFolderAndSelectFile(fileLink);
} else {
String absolutePath = fileLink.toAbsolutePath().getParent().toString();
String command = Globals.prefs.get(JabRefPreferences.FILE_BROWSER_COMMAND);
if (!command.isEmpty()) {
command = command.replaceAll("\\s+", " "); // normalize white spaces

// replace the placeholder if used
command = command.replace("%DIR", absolutePath);
String[] subcommands = command.split(" ");

LOGGER.info("Executing command \"" + command + "\"...");

try {
new ProcessBuilder(subcommands).start();
} catch (IOException exception) {
LOGGER.error("Open File Browser", exception);
JabRefGUI.getMainFrame().getDialogService().notify(Localization.lang("Error occured while executing the command \"%0\".", command));
}
}
}
}

/**
Expand Down Expand Up @@ -228,22 +254,19 @@ public static void openConsole(File file) throws IOException {

if (!command.isEmpty()) {
command = command.replaceAll("\\s+", " "); // normalize white spaces
String[] subcommands = command.split(" ");
command = command.replace("%DIR", absolutePath); // replace the placeholder if used

// replace the placeholder if used
String commandLoggingText = command.replace("%DIR", absolutePath);
String[] subcommands = command.split(" ");

JabRefGUI.getMainFrame().getDialogService().notify(Localization.lang("Executing command \"%0\"...", commandLoggingText));
LOGGER.info("Executing command \"" + commandLoggingText + "\"...");
LOGGER.info("Executing command \"" + command + "\"...");
JabRefGUI.getMainFrame().getDialogService().notify(Localization.lang("Executing command \"%0\"...", command));

try {
new ProcessBuilder(subcommands).start();
} catch (IOException exception) {
LOGGER.error("Open console", exception);

JabRefGUI.getMainFrame().getDialogService().showErrorDialogAndWait(
Localization.lang("Open console") + " - " + Localization.lang("Error",
Localization.lang("Error occured while executing the command \"%0\".", commandLoggingText)));
JabRefGUI.getMainFrame().getDialogService().notify(Localization.lang("Error occured while executing the command \"%0\".", command));
}
}
}
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/org/jabref/gui/desktop/os/Linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ public void openFileWithApplication(String filePath, String application) throws

@Override
public void openFolderAndSelectFile(Path filePath) throws IOException {
String desktopSession = System.getenv("DESKTOP_SESSION").toLowerCase(Locale.ROOT);
String desktopSession = System.getenv("DESKTOP_SESSION");

String cmd;
String cmd = "xdg-open " + filePath.toAbsolutePath().getParent().toString(); //default command

if (desktopSession.contains("gnome")) {
cmd = "nautilus" + filePath.toString().replace(" ", "\\ ");
} else if (desktopSession.contains("kde")) {
cmd = "dolphin --select " + filePath.toString().replace(" ", "\\ ");
} else {
cmd = "xdg-open " + filePath.toAbsolutePath().getParent().toString();
if (desktopSession != null) {
desktopSession = desktopSession.toLowerCase(Locale.ROOT);
if (desktopSession.contains("gnome")) {
cmd = "nautilus" + filePath.toString().replace(" ", "\\ ");
} else if (desktopSession.contains("kde")) {
cmd = "dolphin --select " + filePath.toString().replace(" ", "\\ ");
}
}

Runtime.getRuntime().exec(cmd);
}

Expand All @@ -73,7 +73,6 @@ public void openConsole(String absolutePath) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

String emulatorName = reader.readLine();

if (emulatorName != null) {
emulatorName = emulatorName.substring(emulatorName.lastIndexOf(File.separator) + 1);

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableInsertEntry;
import org.jabref.gui.util.BindingsHelper;
import org.jabref.gui.util.CustomLocalDragboard;
import org.jabref.gui.util.ViewModelTableRowFactory;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -108,7 +109,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame,
}
this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

this.setItems(model.getEntriesFilteredAndSorted());
this.setItems(BindingsHelper.forUI(model.getEntriesFilteredAndSorted()));
// Enable sorting
model.getEntriesFilteredAndSorted().comparatorProperty().bind(this.comparatorProperty());

Expand Down
48 changes: 48 additions & 0 deletions src/main/java/org/jabref/gui/preferences/ExternalTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.OS;
import org.jabref.model.strings.StringUtil;
import org.jabref.preferences.JabRefPreferences;

class ExternalTab implements PrefsTab {
Expand All @@ -38,6 +39,12 @@ class ExternalTab implements PrefsTab {
private final RadioButton sumatraReader;
private final TextField adobeAcrobatReaderPath;
private final TextField sumatraReaderPath;

private final RadioButton defaultFileBrowser;
private final RadioButton executeFileBrowser;
private final TextField fileBrowserCommand;
private final Button fileBrowserButton;

private final GridPane builder = new GridPane();
private final DialogService dialogService;
private final FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder().build();
Expand All @@ -59,11 +66,20 @@ public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPrefere
sumatraReaderPath = new TextField();
Button browseSumatraReader = new Button(Localization.lang("Browse"));

defaultFileBrowser = new RadioButton(Localization.lang("Use default file browser"));
executeFileBrowser = new RadioButton(Localization.lang("Execute Command"));
fileBrowserCommand = new TextField();
fileBrowserButton = new Button(Localization.lang("Browser"));

Label commandDescription = new Label(Localization.lang("Note: Use the placeholder %0 for the location of the opened library file.", "%DIR"));
defaultConsole.setOnAction(e -> updateExecuteConsoleButtonAndFieldEnabledState());
executeConsole.setOnAction(e -> updateExecuteConsoleButtonAndFieldEnabledState());
browseButton.setOnAction(e -> showConsoleChooser());

fileBrowserButton.disableProperty().bind(executeFileBrowser.selectedProperty().not());
fileBrowserCommand.disableProperty().bind(executeFileBrowser.selectedProperty().not());
fileBrowserButton.setOnAction(e -> showFileBrowserCommandChooser());

browseAdobeAcrobatReader.setOnAction(e -> showAdobeChooser());

GridPane consoleOptionPanel = new GridPane();
Expand All @@ -83,6 +99,17 @@ public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPrefere
adobeAcrobatReader.setToggleGroup(pdfReaderGroup);
pdfOptionPanel.add(browseAdobeAcrobatReader, 3, 1);

Label fileBrowserCommandDescription = new Label(Localization.lang("Note: Use the placeholder %0 for the location of the opened library file.", "%DIR"));
GridPane fileBrowserOptionPanel = new GridPane();
final ToggleGroup fileBrowserGroup = new ToggleGroup();
defaultFileBrowser.setToggleGroup(fileBrowserGroup);
executeFileBrowser.setToggleGroup(fileBrowserGroup);
fileBrowserOptionPanel.add(defaultFileBrowser, 1, 1);
fileBrowserOptionPanel.add(executeFileBrowser, 1, 2);
fileBrowserOptionPanel.add(fileBrowserCommand, 2, 2);
fileBrowserOptionPanel.add(fileBrowserButton, 3, 2);
fileBrowserOptionPanel.add(fileBrowserCommandDescription, 2, 3);

if (OS.WINDOWS) {
browseSumatraReader.setOnAction(e -> showSumatraChooser());
pdfOptionPanel.add(sumatraReader, 1, 2);
Expand Down Expand Up @@ -133,6 +160,12 @@ public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPrefere

builder.add(pdfOptionPanel, 1, 13);

Label openFileBrowser = new Label(Localization.lang("Open File Browser"));
openFileBrowser.getStyleClass().add("sectionHeader");
builder.add(openFileBrowser, 1, 14);

builder.add(fileBrowserOptionPanel, 1, 15);

}

@Override
Expand Down Expand Up @@ -165,6 +198,10 @@ public void setValues() {

consoleCommand.setText(Globals.prefs.get(JabRefPreferences.CONSOLE_COMMAND));

defaultFileBrowser.setSelected(Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION));
executeFileBrowser.setSelected(!Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION));
fileBrowserCommand.setText(Globals.prefs.get(JabRefPreferences.FILE_BROWSER_COMMAND));

adobeAcrobatReaderPath.setText(Globals.prefs.get(JabRefPreferences.ADOBE_ACROBAT_COMMAND));
if (OS.WINDOWS) {
sumatraReaderPath.setText(Globals.prefs.get(JabRefPreferences.SUMATRA_PDF_COMMAND));
Expand All @@ -187,6 +224,13 @@ public void storeSettings() {
prefs.putBoolean(JabRefPreferences.USE_DEFAULT_CONSOLE_APPLICATION, defaultConsole.isSelected());
prefs.put(JabRefPreferences.CONSOLE_COMMAND, consoleCommand.getText());
prefs.put(JabRefPreferences.ADOBE_ACROBAT_COMMAND, adobeAcrobatReaderPath.getText());

prefs.putBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION, defaultFileBrowser.isSelected());
if (StringUtil.isNotBlank(fileBrowserCommand.getText())) {
prefs.put(JabRefPreferences.FILE_BROWSER_COMMAND, fileBrowserCommand.getText());
} else {
prefs.putBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION, true); //default if no command specified
}
if (OS.WINDOWS) {
prefs.put(JabRefPreferences.SUMATRA_PDF_COMMAND, sumatraReaderPath.getText());
}
Expand Down Expand Up @@ -220,6 +264,10 @@ private void showSumatraChooser() {
dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(file -> sumatraReaderPath.setText(file.toAbsolutePath().toString()));
}

private void showFileBrowserCommandChooser() {
dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(file -> fileBrowserCommand.setText(file.toAbsolutePath().toString()));
}

private void readerSelected() {
if (adobeAcrobatReader.isSelected()) {
prefs.put(JabRefPreferences.USE_PDF_READER, adobeAcrobatReaderPath.getText());
Expand Down
Loading

0 comments on commit 3dfdf20

Please sign in to comment.