From 795be35ca566e153662471f325466e618cc997d0 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 19 Sep 2024 19:54:30 +0200 Subject: [PATCH 1/2] Fix ai chat not on fx thread Fixes https://github.com/JabRef/jabref-issue-melting-pot/issues/549 --- .../org/jabref/gui/ai/components/aichat/AiChatComponent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java b/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java index c1a43b45dbd..8670e1055bf 100644 --- a/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java +++ b/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java @@ -21,12 +21,14 @@ import org.jabref.gui.ai.components.util.notifications.Notification; import org.jabref.gui.ai.components.util.notifications.NotificationsComponent; import org.jabref.gui.icon.IconTheme; +import org.jabref.gui.util.UiTaskExecutor; import org.jabref.logic.ai.AiPreferences; import org.jabref.logic.ai.AiService; import org.jabref.logic.ai.chatting.AiChatLogic; import org.jabref.logic.ai.util.CitationKeyCheck; import org.jabref.logic.ai.util.ErrorMessage; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.layout.format.Default; import org.jabref.logic.util.BackgroundTask; import org.jabref.logic.util.TaskExecutor; import org.jabref.logic.util.io.FileUtil; @@ -140,7 +142,7 @@ private void updateNotifications() { notificationsButton.setManaged(!notifications.isEmpty()); if (!notifications.isEmpty()) { - notificationsButton.setGraphic(IconTheme.JabRefIcons.WARNING.withColor(Color.YELLOW).getGraphicNode()); + UiTaskExecutor.runInJavaFXThread(() -> notificationsButton.setGraphic(IconTheme.JabRefIcons.WARNING.withColor(Color.YELLOW).getGraphicNode())); } } From 8d7a5e91725fbb5b6c6ada3835d93cc36c6a9d26 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 19 Sep 2024 20:30:38 +0200 Subject: [PATCH 2/2] fix import --- .../org/jabref/gui/ai/components/aichat/AiChatComponent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java b/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java index 8670e1055bf..25e52d294e4 100644 --- a/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java +++ b/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java @@ -28,7 +28,6 @@ import org.jabref.logic.ai.util.CitationKeyCheck; import org.jabref.logic.ai.util.ErrorMessage; import org.jabref.logic.l10n.Localization; -import org.jabref.logic.layout.format.Default; import org.jabref.logic.util.BackgroundTask; import org.jabref.logic.util.TaskExecutor; import org.jabref.logic.util.io.FileUtil;