Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into oofix
Browse files Browse the repository at this point in the history
* upstream/master:
  fix checsktyle
  Fix for application dialogs opening in wrong displays (#7273)
  Only disable  move to file dir when path equals (#7269)
  Improved detection of long DOI's within text (#7260)
  Add missing author and fix name
  Fix style of highlighted checkboxes while searching in preferences (#7258)
  Updates to institution citation keys (#7210)
  Bump xmlunit-core from 2.8.1 to 2.8.2 (#7251)
  Bump classgraph from 4.8.97 to 4.8.98 (#7250)
  Bump bcprov-jdk15on from 1.67 to 1.68 (#7249)
  Bump xmlunit-matchers from 2.8.1 to 2.8.2 (#7252)
  Bump unirest-java from 3.11.06 to 3.11.09 (#7254)
  Bump org.beryx.jlink from 2.23.0 to 2.23.1 (#7253)
  Bump pascalgn/automerge-action from v0.12.0 to v0.13.0 (#7255)

# Conflicts:
#	src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
  • Loading branch information
Siedlerchr committed Jan 3, 2021
2 parents bfb2fc9 + 60cc355 commit 63fb86a
Show file tree
Hide file tree
Showing 67 changed files with 408 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Merge pull requests
uses: pascalgn/automerge-action@v0.12.0
uses: pascalgn/automerge-action@v0.13.0
if: steps.waitforstatuschecks.outputs.status == 'success'
env:
MERGE_METHOD: "squash"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,6 @@ jobs:
echo
echo "In case you want to use a different one, please comment here and adjust your name in your git configuration for future commits"
echo
echo "Just adding yourself into the AUHTORS file does not help as it is overwritten by our script ./scripts/generate-authors."
echo "Just adding yourself into the AUTHORS file does not help as it is overwritten by our script ./scripts/generate-authors."
echo "Read more on the AUTHORS file at found at https://github.com/JabRef/jabref/blob/master/CONTRIBUTING.md#author-credits"
exit 1
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ Felix Luthman
Felix Wilke
Fernando Santagata
ffffatgoose
Fiyinfolu Eludire
Florian Beetz
Florian Straßer
Foivos Christoulakis
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Fixed

- We fixed an issue with the style of highlighted check boxes while searching in preferences. [#7226](https://github.com/JabRef/jabref/issues/7226)
- We fixed an issue where the option "Move file to file directory" was disabled in the entry editor for all files [#7194](https://github.com/JabRef/jabref/issues/7194)
- We fixed an issue where application dialogs were opening in the wrong display when using multiple screens [#7273](https://github.com/JabRef/jabref/pull/7273)

### Removed

## [5.2] – 2020-12-24
Expand Down Expand Up @@ -90,6 +94,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the password for a shared SQL database was not remembered [#6869](https://github.com/JabRef/jabref/issues/6869)
- We fixed an issue where newly added entires were not synced to a shared SQL database [#7176](https://github.com/JabRef/jabref/issues/7176)
- We fixed an issue where the PDF-Content importer threw an exception when no DOI number is present at the first page of the PDF document [#7203](https://github.com/JabRef/jabref/issues/7203)
- We fixed an issue where authors that only have last names were incorrectly identified as institutes when generating citation keys [#7199](https://github.com/JabRef/jabref/issues/7199)
- We fixed an issue where institutes were incorrectly identified as universities when generating citation keys [#6942](https://github.com/JabRef/jabref/issues/6942)

### Removed

Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.36.0'
id 'org.javamodularity.moduleplugin' version '1.7.0'
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.beryx.jlink' version '2.23.0'
id 'org.beryx.jlink' version '2.23.1'
// nicer test outputs during running and completion
// Homepage: https://github.com/radarsh/gradle-test-logger-plugin
id 'com.adarshr.test-logger' version '2.1.1'
Expand Down Expand Up @@ -106,7 +106,7 @@ dependencies {
implementation group: 'org.apache.tika', name: 'tika-core', version: '1.25'

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

implementation 'commons-cli:commons-cli:1.4'

Expand Down Expand Up @@ -157,7 +157,7 @@ dependencies {
implementation 'org.controlsfx:controlsfx:11.0.3'

implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.konghq:unirest-java:3.11.06'
implementation 'com.konghq:unirest-java:3.11.09'

implementation 'org.slf4j:slf4j-api:2.0.0-alpha1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT'
Expand Down Expand Up @@ -186,7 +186,7 @@ dependencies {
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.62.2'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.62.2'

testImplementation 'io.github.classgraph:classgraph:4.8.97'
testImplementation 'io.github.classgraph:classgraph:4.8.98'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.7.0'
Expand All @@ -195,8 +195,8 @@ dependencies {
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.6.28'
testImplementation 'org.xmlunit:xmlunit-core:2.8.1'
testImplementation 'org.xmlunit:xmlunit-matchers:2.8.1'
testImplementation 'org.xmlunit:xmlunit-core:2.8.2'
testImplementation 'org.xmlunit:xmlunit-matchers:2.8.2'
testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.15.0'
testImplementation 'com.tngtech.archunit:archunit-junit5-api:0.15.0'
testImplementation "org.testfx:testfx-core:4.0.17-alpha-SNAPSHOT"
Expand Down
20 changes: 19 additions & 1 deletion docs/getting-into-the-code/code-howtos.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Principles:
Localization.lang("Something went wrong...", ioe);
}
```

* Never, ever throw and catch `Exception` or `Throwable`
* Errors should only be logged when they are finally caught \(i.e., logged only once\). See **Logging** for details.
* If the Exception message is intended to be shown to the User in the UI \(see below\) provide also a localizedMessage \(see `JabRefException`\).
Expand Down Expand Up @@ -57,7 +58,7 @@ Many times there is a need to provide an object on many locations simultaneously
### Main principle
`EventBus` represents a communication line between multiple components. Objects can be passed through the bus and reach the listening method of another object which is registered on that `EventBus` instance. Hence the passed object is available as a parameter in the listening method.
`EventBus` represents a communication line between multiple components. Objects can be passed through the bus and reach the listening method of another object which is registered on that `EventBus` instance. Hence, the passed object is available as a parameter in the listening method.
### Register to the `EventBus`
Expand Down Expand Up @@ -398,3 +399,20 @@ All radio buttons that should be grouped together need to have a ToggleGroup def
</VBox>
```

### JavaFX Dialogs

All dialogs should be displayed to the user via `DialogService` interface methods.
`DialogService` provides methods to display various dialogs (including custom ones) to the user.
It also ensures the displayed dialog opens on the correct window via `initOwner()` (for cases where the user has multiple screens).
The following code snippet demonstrates how a custom dialog is displayed to the user:

```java
dialogService.showCustomDialog(new DocumentViewerView());
```

If an instance of `DialogService` is unavailable within current class/scope in which the dialog needs to be displayed,
`DialogService` can be instantiated via the code snippet shown as follows:

```java
DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
```
1 change: 1 addition & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
requires reactfx;
requires commons.cli;
requires com.github.tomtung.latex2unicode;
requires fastparse;
requires jbibtex;
requires citeproc.java;
requires antlr.runtime;
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,11 @@
}

.check-box > .box > .mark {
-fx-background-color: -fx-control-inner-background;
-fx-padding: 0.2em 0.2em 0.2em 0.2em;
}

.check-box:selected > .box > .mark {
-fx-background-color: -fx-control-inner-background;
-fx-shape: "M6.61 11.89L3.5 8.78 2.44 9.84 6.61 14l8.95-8.95L14.5 4z";
-fx-stroke-width: 5;
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/jabref/gui/DialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javafx.scene.control.DialogPane;
import javafx.scene.control.TextInputDialog;

import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -160,6 +161,13 @@ boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
String okButtonLabel, String cancelButtonLabel,
String optOutMessage, Consumer<Boolean> optOutAction);

/**
* Shows a custom dialog without returning any results.
*
* @param dialog dialog to show
*/
void showCustomDialog(BaseDialog<?> dialog);

/**
* This will create and display a new dialog of the specified
* {@link Alert.AlertType} but with user defined buttons as optional
Expand All @@ -184,7 +192,7 @@ Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String
* @param dialog dialog to show
* @param <R> type of result
*/
<R> Optional<R> showCustomDialogAndWait(Dialog<R> dialog);
<R> Optional<R> showCustomDialogAndWait(javafx.scene.control.Dialog<R> dialog);

/**
* Constructs and shows a canceable {@link ProgressDialog}. Clicking cancel will cancel the underlying service and close the dialog
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/EntryTypeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void runFetcherWorker() {
Optional<BibEntry> duplicate = new DuplicateCheck(Globals.entryTypesManager).containsDuplicate(libraryTab.getDatabase(), entry, libraryTab.getBibDatabaseContext().getMode());
if ((duplicate.isPresent())) {
DuplicateResolverDialog dialog = new DuplicateResolverDialog(entry, duplicate.get(), DuplicateResolverDialog.DuplicateResolverType.IMPORT_CHECK, libraryTab.getBibDatabaseContext(), stateManager);
switch (dialog.showAndWait().orElse(DuplicateResolverDialog.DuplicateResolverResult.BREAK)) {
switch (dialogService.showCustomDialogAndWait(dialog).orElse(DuplicateResolverDialog.DuplicateResolverResult.BREAK)) {
case KEEP_LEFT:
libraryTab.getDatabase().removeEntry(duplicate.get());
libraryTab.getDatabase().insertEntry(entry);
Expand Down
30 changes: 23 additions & 7 deletions src/main/java/org/jabref/gui/JabRefDialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.gui.util.ZipFileChooser;
Expand Down Expand Up @@ -78,17 +79,18 @@ public JabRefDialogService(Window mainWindow, Pane mainPane, PreferencesService
JabRefDialogService.preferences = preferences;
}

private static FXDialog createDialog(AlertType type, String title, String content) {
private FXDialog createDialog(AlertType type, String title, String content) {
FXDialog alert = new FXDialog(type, title, true);
preferences.getTheme().installCss(alert.getDialogPane().getScene());
alert.setHeaderText(null);
alert.setContentText(content);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.initOwner(mainWindow);
return alert;
}

private static FXDialog createDialogWithOptOut(AlertType type, String title, String content,
String optOutMessage, Consumer<Boolean> optOutAction) {
private FXDialog createDialogWithOptOut(AlertType type, String title, String content,
String optOutMessage, Consumer<Boolean> optOutAction) {
FXDialog alert = new FXDialog(type, title, true);
// Need to force the alert to layout in order to grab the graphic as we are replacing the dialog pane with a custom pane
alert.getDialogPane().applyCss();
Expand Down Expand Up @@ -117,6 +119,7 @@ protected Node createDetailsButton() {
alert.setHeaderText(null);
alert.setContentText(content);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.initOwner(mainWindow);
return alert;
}

Expand All @@ -136,6 +139,7 @@ public <T> Optional<T> showChoiceDialogAndWait(String title, String content, Str
choiceDialog.setHeaderText(title);
choiceDialog.setTitle(title);
choiceDialog.setContentText(content);
choiceDialog.initOwner(mainWindow);
preferences.getTheme().installCss(choiceDialog.getDialogPane().getScene());
return choiceDialog.showAndWait();
}
Expand All @@ -145,6 +149,7 @@ public Optional<String> showInputDialogAndWait(String title, String content) {
TextInputDialog inputDialog = new TextInputDialog();
inputDialog.setHeaderText(title);
inputDialog.setContentText(content);
inputDialog.initOwner(mainWindow);
preferences.getTheme().installCss(inputDialog.getDialogPane().getScene());
return inputDialog.showAndWait();
}
Expand All @@ -154,6 +159,7 @@ public Optional<String> showInputDialogWithDefaultAndWait(String title, String c
TextInputDialog inputDialog = new TextInputDialog(defaultValue);
inputDialog.setHeaderText(title);
inputDialog.setContentText(content);
inputDialog.initOwner(mainWindow);
preferences.getTheme().installCss(inputDialog.getDialogPane().getScene());
return inputDialog.showAndWait();
}
Expand Down Expand Up @@ -181,6 +187,7 @@ public void showErrorDialogAndWait(String message, Throwable exception) {
ExceptionDialog exceptionDialog = new ExceptionDialog(exception);
exceptionDialog.getDialogPane().setMaxWidth(mainWindow.getWidth() / 2);
exceptionDialog.setHeaderText(message);
exceptionDialog.initOwner(mainWindow);
preferences.getTheme().installCss(exceptionDialog.getDialogPane().getScene());
exceptionDialog.showAndWait();
}
Expand All @@ -190,6 +197,7 @@ public void showErrorDialogAndWait(String title, String content, Throwable excep
ExceptionDialog exceptionDialog = new ExceptionDialog(exception);
exceptionDialog.setHeaderText(title);
exceptionDialog.setContentText(content);
exceptionDialog.initOwner(mainWindow);
preferences.getTheme().installCss(exceptionDialog.getDialogPane().getScene());
exceptionDialog.showAndWait();
}
Expand Down Expand Up @@ -259,12 +267,14 @@ public Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane con
alert.getButtonTypes().setAll(buttonTypes);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(true);
alert.initOwner(mainWindow);
preferences.getTheme().installCss(alert.getDialogPane().getScene());
return alert.showAndWait();
}

@Override
public <R> Optional<R> showCustomDialogAndWait(Dialog<R> dialog) {
public <R> Optional<R> showCustomDialogAndWait(javafx.scene.control.Dialog<R> dialog) {
dialog.initOwner(mainWindow);
return dialog.showAndWait();
}

Expand All @@ -285,6 +295,7 @@ public <V> void showProgressDialog(String title, String content, Task<V> task) {
progressDialog.close();
});
preferences.getTheme().installCss(progressDialog.getDialogPane().getScene());
progressDialog.initOwner(mainWindow);
progressDialog.show();
}

Expand All @@ -307,6 +318,7 @@ public <V> Optional<ButtonType> showBackgroundProgressDialogAndWait(String title
alert.getButtonTypes().setAll(ButtonType.YES, ButtonType.CANCEL);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(true);
alert.initOwner(mainWindow);
preferences.getTheme().installCss(alert.getDialogPane().getScene());

stateManager.getAnyTaskRunning().addListener((observable, oldValue, newValue) -> {
Expand All @@ -316,9 +328,7 @@ public <V> Optional<ButtonType> showBackgroundProgressDialogAndWait(String title
}
});

Dialog<ButtonType> dialog = alert::showAndWait;

return showCustomDialogAndWait(dialog);
return alert.showAndWait();
}

@Override
Expand Down Expand Up @@ -385,4 +395,10 @@ public Optional<Path> showFileOpenFromArchiveDialog(Path archivePath) throws IOE
throw new IOException("Could not instantiate ZIP-archive reader.", exc);
}
}

@Override
public void showCustomDialog(BaseDialog<?> aboutDialogView) {
aboutDialogView.initOwner(mainWindow);
aboutDialogView.show();
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ private void addImportedEntries(final LibraryTab panel, final ParserResult parse
cleanup.doPostCleanup(parserResult.getDatabase().getEntries());
ImportEntriesDialog dialog = new ImportEntriesDialog(panel.getBibDatabaseContext(), task);
dialog.setTitle(Localization.lang("Import"));
dialog.showAndWait();
dialogService.showCustomDialogAndWait(dialog);
}

public FileHistoryMenu getFileHistory() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.jabref.gui.auximport;

import org.jabref.gui.DialogService;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;

import com.airhacks.afterburner.injection.Injector;

import static org.jabref.gui.actions.ActionHelper.needsDatabase;

/**
Expand All @@ -21,7 +24,7 @@ public NewSubLibraryAction(JabRefFrame jabRefFrame, StateManager stateManager) {

@Override
public void execute() {
FromAuxDialog dialog = new FromAuxDialog(jabRefFrame);
dialog.showAndWait();
DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
dialogService.showCustomDialogAndWait(new FromAuxDialog(jabRefFrame));
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package org.jabref.gui.bibtexextractor;

import org.jabref.gui.DialogService;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;

import com.airhacks.afterburner.injection.Injector;

import static org.jabref.gui.actions.ActionHelper.needsDatabase;

public class ExtractBibtexAction extends SimpleCommand {
Expand All @@ -13,7 +16,7 @@ public ExtractBibtexAction(StateManager stateManager) {

@Override
public void execute() {
ExtractBibtexDialog dlg = new ExtractBibtexDialog();
dlg.showAndWait();
DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
dialogService.showCustomDialogAndWait(new ExtractBibtexDialog());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.jabref.gui.citationkeypattern;

import org.jabref.gui.DialogService;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;

import com.airhacks.afterburner.injection.Injector;

import static org.jabref.gui.actions.ActionHelper.needsDatabase;

public class CitationKeyPatternAction extends SimpleCommand {
Expand All @@ -18,6 +21,7 @@ public CitationKeyPatternAction(JabRefFrame frame, StateManager stateManager) {

@Override
public void execute() {
new CitationKeyPatternDialog(frame.getCurrentLibraryTab()).showAndWait();
DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
dialogService.showCustomDialogAndWait(new CitationKeyPatternDialog(frame.getCurrentLibraryTab()));
}
}
Loading

0 comments on commit 63fb86a

Please sign in to comment.