mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] handling 'mailto' URLs in BrowserLauncher.open
This commit is contained in:
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.Contract
|
||||
import java.awt.Desktop
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.net.URI
|
||||
import java.util.*
|
||||
|
||||
open class BrowserLauncherAppless : BrowserLauncher() {
|
||||
@@ -100,6 +101,16 @@ open class BrowserLauncherAppless : BrowserLauncher() {
|
||||
private fun openOrBrowse(_url: String, browse: Boolean, project: Project? = null) {
|
||||
val url = signUrl(_url.trim { it <= ' ' })
|
||||
|
||||
if (url.startsWith("mailto:") && Desktop.getDesktop().isSupported(Desktop.Action.MAIL)) {
|
||||
try {
|
||||
Desktop.getDesktop().mail(URI(url))
|
||||
}
|
||||
catch (e: Exception) {
|
||||
LOG.warn("failed to open: $url", e)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (!BrowserUtil.isAbsoluteURL(url)) {
|
||||
val file = File(url)
|
||||
if (!browse && isDesktopActionSupported(Desktop.Action.OPEN)) {
|
||||
|
||||
Reference in New Issue
Block a user