From 2bed3d39d8ecdd37645ba8998114386551eba82e Mon Sep 17 00:00:00 2001 From: Gary Mejia <50064854+garymejia@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:49:13 -0500 Subject: [PATCH] Implement scrollable warning messages in alert boxes (#10700) * Set warning message content within a TextArea object to enable scrolling within the alertbox. * Modified getErrorMessage() to utilize a newline delimiter for the join function, displaying its contents on separate lines. * Updated order of import to comply with checkstyle. --- src/main/java/org/jabref/gui/JabRefDialogService.java | 7 ++++++- src/main/java/org/jabref/logic/importer/ParserResult.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/JabRefDialogService.java b/src/main/java/org/jabref/gui/JabRefDialogService.java index 6f3c333db13..6b595654d31 100644 --- a/src/main/java/org/jabref/gui/JabRefDialogService.java +++ b/src/main/java/org/jabref/gui/JabRefDialogService.java @@ -25,6 +25,7 @@ import javafx.scene.control.ChoiceDialog; import javafx.scene.control.DialogPane; import javafx.scene.control.Label; +import javafx.scene.control.TextArea; import javafx.scene.control.TextInputDialog; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; @@ -79,8 +80,12 @@ public JabRefDialogService(Window mainWindow) { private FXDialog createDialog(AlertType type, String title, String content) { FXDialog alert = new FXDialog(type, title, true); alert.setHeaderText(null); - alert.setContentText(content); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); + alert.setResizable(true); + + TextArea area = new TextArea(content); + + alert.getDialogPane().setContent(area); alert.initOwner(mainWindow); return alert; } diff --git a/src/main/java/org/jabref/logic/importer/ParserResult.java b/src/main/java/org/jabref/logic/importer/ParserResult.java index 2f134224562..c5f61ef3513 100644 --- a/src/main/java/org/jabref/logic/importer/ParserResult.java +++ b/src/main/java/org/jabref/logic/importer/ParserResult.java @@ -132,7 +132,7 @@ public void setInvalid(boolean invalid) { } public String getErrorMessage() { - return String.join(" ", warnings()); + return String.join("\n", warnings()); } public BibDatabaseContext getDatabaseContext() {