Skip to content

Commit

Permalink
#213: opens File / external application in own thread to fix freeze o…
Browse files Browse the repository at this point in the history
…n Linux
  • Loading branch information
rladstaetter committed Apr 11, 2024
1 parent a2e6f3f commit 0c8676b
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

}

0 comments on commit 0c8676b

Please sign in to comment.