Skip to content

Commit

Permalink
Fix libre office connection and other progress dialogs (#6478)
Browse files Browse the repository at this point in the history
* Fix libre office connection and other progress dialogs

Fixes #6477

* fix checkstyle

* Rename to show
  • Loading branch information
Siedlerchr authored May 14, 2020
1 parent 09111be commit 46777c2
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
Binary file modified lib/libreoffice.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/DialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String
* @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> Optional<Void> showProgressDialogAndWait(String title, String content, Task<V> task);
<V> void showProgressDialog(String title, String content, Task<V> task);

/**
* Constructs and shows a dialog showing the progress of running background tasks.
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/JabRefDialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public <R> Optional<R> showCustomDialogAndWait(Dialog<R> dialog) {
}

@Override
public <V> Optional<Void> showProgressDialogAndWait(String title, String content, Task<V> task) {
public <V> void showProgressDialog(String title, String content, Task<V> task) {
ProgressDialog progressDialog = new ProgressDialog(task);
progressDialog.setHeaderText(null);
progressDialog.setTitle(title);
Expand All @@ -288,12 +288,12 @@ public <V> Optional<Void> showProgressDialogAndWait(String title, String content
progressDialog.close();
});
themeLoader.installCss(progressDialog.getDialogPane().getScene(), preferences);
return progressDialog.showAndWait();
progressDialog.show();
}

@Override
public <V> Optional<ButtonType> showBackgroundProgressDialogAndWait(String title, String content, StateManager stateManager) {
TaskProgressView taskProgressView = new TaskProgressView();
TaskProgressView taskProgressView = new TaskProgressView<>();
EasyBind.listBind(taskProgressView.getTasks(), stateManager.getBackgroundTasks());
taskProgressView.setRetainTasks(false);
taskProgressView.setGraphicFactory(BackgroundTask::getIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected Void call() throws Exception {
}
};

dialogService.showProgressDialogAndWait(
dialogService.showProgressDialog(
Localization.lang("Please wait..."),
Localization.lang("Waiting for save operation to finish") + "...",
waitForSaveFinished
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void execute() {
Optional<Path> exportPath = dialogService.showDirectorySelectionDialog(dirDialogConfiguration);
exportPath.ifPresent(path -> {
Task<List<CopyFilesResultItemViewModel>> exportTask = new CopyFilesTask(database, entries, path);
dialogService.showProgressDialogAndWait(
dialogService.showProgressDialog(
Localization.lang("Copy linked files to folder..."),
Localization.lang("Copy linked files to folder..."),
exportTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void succeeded() {
}
};

dialogService.showProgressDialogAndWait(
dialogService.showProgressDialog(
Localization.lang("Automatically setting file links"),
Localization.lang("Searching for files"),
linkFilesTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected Map<BibEntry, Optional<URL>> call() {
findFullTextsTask.setOnSucceeded(value ->
downloadFullTexts(findFullTextsTask.getValue(), stateManager.getActiveDatabase().get()));

dialogService.showProgressDialogAndWait(
dialogService.showProgressDialog(
Localization.lang("Download full text documents"),
Localization.lang("Looking for full text document..."),
findFullTextsTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected List<IntegrityMessage> call() {
});
task.setOnFailed(event -> dialogService.showErrorDialogAndWait("Integrity check failed."));

dialogService.showProgressDialogAndWait(
dialogService.showProgressDialog(
Localization.lang("Checking integrity..."),
Localization.lang("Checking integrity..."),
task);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ private void connectAutomatically() {
connect();
} else {

Task<Void> taskConnectIfInstalled = new Task<Void>() {
Task<Void> taskConnectIfInstalled = new Task<>() {

@Override
protected Void call() throws Exception {
Expand All @@ -350,7 +350,7 @@ protected Void call() throws Exception {
taskConnectIfInstalled.setOnSucceeded(value -> connect());
taskConnectIfInstalled.setOnFailed(value -> dialogService.showErrorDialogAndWait(Localization.lang("Autodetection failed"), Localization.lang("Autodetection failed"), taskConnectIfInstalled.getException()));

dialogService.showProgressDialogAndWait(Localization.lang("Autodetecting paths..."), Localization.lang("Autodetecting paths..."), taskConnectIfInstalled);
dialogService.showProgressDialog(Localization.lang("Autodetecting paths..."), Localization.lang("Autodetecting paths..."), taskConnectIfInstalled);
taskExecutor.execute(taskConnectIfInstalled);
}
}
Expand Down Expand Up @@ -418,7 +418,7 @@ protected OOBibBase call() throws Exception {
}
});

dialogService.showProgressDialogAndWait(Localization.lang("Autodetecting paths..."), Localization.lang("Autodetecting paths..."), connectTask);
dialogService.showProgressDialog(Localization.lang("Autodetecting paths..."), Localization.lang("Autodetecting paths..."), connectTask);
taskExecutor.execute(connectTask);
}

Expand Down

0 comments on commit 46777c2

Please sign in to comment.