From 0c8676ba0d379c91870e4c6f4ba39e0cc4867ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Ladst=C3=A4tter?= Date: Thu, 11 Apr 2024 23:31:07 +0200 Subject: [PATCH] #213: opens File / external application in own thread to fix freeze on Linux --- .../logfiletab/actions/OpenInFinderMenuItem.scala | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/scala/app/logorrr/views/logfiletab/actions/OpenInFinderMenuItem.scala b/app/src/main/scala/app/logorrr/views/logfiletab/actions/OpenInFinderMenuItem.scala index e84b8f32..7477bb18 100644 --- a/app/src/main/scala/app/logorrr/views/logfiletab/actions/OpenInFinderMenuItem.scala +++ b/app/src/main/scala/app/logorrr/views/logfiletab/actions/OpenInFinderMenuItem.scala @@ -8,16 +8,21 @@ import java.awt.Desktop object OpenInFinderMenuItem { val menuItemText: String = if (OsUtil.isWin) { - "Show Log in Explorer" + "Show File in Explorer" } else if (OsUtil.isMac) { - "Show Log in Finder" + "Show File in Finder" } else { - "Show Log ..." + "Show File ..." } } class OpenInFinderMenuItem(fileId: FileId) extends MenuItem(OpenInFinderMenuItem.menuItemText) { - setOnAction(_ => Desktop.getDesktop.open(fileId.asPath.getParent.toFile)) + setOnAction(_ => { + val directoryToOpen = fileId.asPath.getParent.toFile + new Thread(new Runnable { + override def run(): Unit = Desktop.getDesktop.open(directoryToOpen) + }).start() + }) }