Skip to content

Commit

Permalink
Merge pull request #214 from rladstaetter/213-on-linux-logorrr-freeze…
Browse files Browse the repository at this point in the history
…s-when-choosing-show-log-from-context-menu

#213: opens File / external application in own thread to fix freeze
  • Loading branch information
rladstaetter authored Apr 11, 2024
2 parents a2e6f3f + 0c8676b commit 931941d
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 931941d

Please sign in to comment.