Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ooPanel
Browse files Browse the repository at this point in the history
* upstream/master:
  Add uncaught exception message (#4565)
  Converts integrity check dialog to JavaFX (#4559)
  Do not extract file ending from Urls (#4547)
  Bump checkstyle from 8.15 to 8.16 (#4562)
  Bump xmpbox from 2.0.12 to 2.0.13 (#4561)
  Delete the deprecated BibEntry Constructor (#4560)

# Conflicts:
#	src/main/java/org/jabref/gui/DialogService.java
#	src/main/java/org/jabref/gui/FXDialogService.java
#	src/main/java/org/jabref/gui/actions/CopyFilesAction.java
#	src/main/java/org/jabref/gui/util/CurrentThreadTaskExecutor.java
  • Loading branch information
Siedlerchr committed Jan 10, 2019
2 parents 126ef78 + d281ece commit 50d1bd9
Show file tree
Hide file tree
Showing 25 changed files with 367 additions and 283 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ 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 uncaught exceptions were logged but the user wasn't informed about their occurance. [#2288] (https://github.com/JabRef/jabref/issues/2288)



Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ dependencies {

compile 'org.apache.pdfbox:pdfbox:2.0.13'
compile 'org.apache.pdfbox:fontbox:2.0.13'
compile 'org.apache.pdfbox:xmpbox:2.0.12'
compile 'org.apache.pdfbox:xmpbox:2.0.13'

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

// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
compile 'org.bouncycastle:bcprov-jdk15on:1.60'
Expand Down Expand Up @@ -180,7 +182,7 @@ dependencies {
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"

checkstyle 'com.puppycrawl.tools:checkstyle:8.15'
checkstyle 'com.puppycrawl.tools:checkstyle:8.16'
}

jacoco {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/FallbackExceptionHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ public static void installExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable exception) {
LOGGER.error("Uncaught exception occurred in " + thread, exception);
JabRefGUI.getMainFrame()
.getDialogService()
.showErrorDialogAndWait(
exception.getLocalizedMessage(), exception);
}
}
10 changes: 6 additions & 4 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;

import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.geometry.Orientation;
import javafx.scene.Node;
Expand Down Expand Up @@ -693,11 +694,12 @@ public void insertEntry(final BibEntry bibEntry) {
}
}

public void editEntryByIdAndFocusField(final String entryId, final String fieldName) {
bibDatabaseContext.getDatabase().getEntryById(entryId).ifPresent(entry -> {
clearAndSelect(entry);
showAndEdit(entry);
public void editEntryAndFocusField(BibEntry entry, String fieldName) {
showAndEdit(entry);
Platform.runLater(() -> {
// Focus field and entry in main table (async to give entry editor time to load)
entryEditor.setFocusToField(fieldName);
clearAndSelect(entry);
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/DialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String
/**
* Constructs and shows a canceable {@link ProgressDialog}. Clicking cancel will cancel the underlying service and close the dialog
*
* @param title title of the dialog
* @param content message to show above the progress bar
* @param task The {@link Task} which executes the work and for which to show the dialog
*/
<V> void showCanceableProgressDialogAndWait(Task<V> task, String title);
<V> void showProgressDialogAndWait(String title, String content, Task<V> task);

/**
* Notify the user in an non-blocking way (i.e., in form of toast in a snackbar).
Expand Down
19 changes: 7 additions & 12 deletions src/main/java/org/jabref/gui/FXDialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import javafx.scene.layout.Region;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.stage.Window;

import org.jabref.JabRefGUI;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -220,26 +222,19 @@ public Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane con
return alert.showAndWait();
}

@Override
public FXDialog showCustomDialog(String title, DialogPane contentPane,
ButtonType... buttonTypes) {
FXDialog alert = new FXDialog(AlertType.NONE, title);
alert.setDialogPane(contentPane);
alert.getButtonTypes().setAll(buttonTypes);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(true);
return alert;
}

@Override
public <R> Optional<R> showCustomDialogAndWait(Dialog<R> dialog) {
return dialog.showAndWait();
}

@Override
public <V> void showCanceableProgressDialogAndWait(Task<V> task, String title) {
public <V> void showProgressDialogAndWait(String title, String content, Task<V> task) {
ProgressDialog progressDialog = new ProgressDialog(task);
progressDialog.setHeaderText(null);
progressDialog.setTitle(title);
progressDialog.setContentText(content);
progressDialog.setGraphic(null);
((Stage) progressDialog.getDialogPane().getScene().getWindow()).getIcons().add(IconTheme.getJabRefImageFX());
progressDialog.setOnCloseRequest(evt -> task.cancel());
DialogPane dialogPane = progressDialog.getDialogPane();
dialogPane.getButtonTypes().add(ButtonType.CANCEL);
Expand Down
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 @@ -62,7 +62,6 @@
import org.jabref.gui.actions.DatabasePropertiesAction;
import org.jabref.gui.actions.EditExternalFileTypesAction;
import org.jabref.gui.actions.ErrorConsoleAction;
import org.jabref.gui.actions.IntegrityCheckAction;
import org.jabref.gui.actions.LookupIdentifierAction;
import org.jabref.gui.actions.ManageCustomExportsAction;
import org.jabref.gui.actions.ManageCustomImportsAction;
Expand Down Expand Up @@ -94,6 +93,7 @@
import org.jabref.gui.importer.ImportCommand;
import org.jabref.gui.importer.ImportInspectionDialog;
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.gui.integrity.IntegrityCheckAction;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.menus.FileHistoryMenu;
import org.jabref.gui.mergeentries.MergeEntriesAction;
Expand Down
17 changes: 6 additions & 11 deletions src/main/java/org/jabref/gui/actions/CopyFilesAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ public CopyFilesAction(JabRefFrame frame) {
this.dialogService = frame.getDialogService();
}

private void startServiceAndshowProgessDialog(Task<List<CopyFilesResultItemViewModel>> exportService) {

dialogService.showCanceableProgressDialogAndWait(exportService, Localization.lang("Copy linked files to folder..."));

exportService.run();
exportService.setOnSucceeded((e) -> {
showDialog(exportService.getValue());
});
}

private void showDialog(List<CopyFilesResultItemViewModel> data) {
if (data.isEmpty()) {
dialogService.showInformationDialogAndWait(Localization.lang("Copy linked files to folder..."), Localization.lang("No linked files found for export."));
Expand All @@ -64,7 +54,12 @@ public void execute() {
databaseContext = frame.getCurrentBasePanel().getBibDatabaseContext();

Task<List<CopyFilesResultItemViewModel>> exportTask = new CopyFilesTask(databaseContext, entries, path);
startServiceAndshowProgessDialog(exportTask);
dialogService.showProgressDialogAndWait(
Localization.lang("Copy linked files to folder..."),
Localization.lang("Copy linked files to folder..."),
exportTask);
Globals.TASK_EXECUTOR.execute(exportTask);
exportTask.setOnSucceeded((e) -> showDialog(exportTask.getValue()));
});

}
Expand Down
202 changes: 0 additions & 202 deletions src/main/java/org/jabref/gui/actions/IntegrityCheckAction.java

This file was deleted.

Loading

0 comments on commit 50d1bd9

Please sign in to comment.