linkbrowser: prefer xdg-open over Desktop.open and browse

Desktop.open/Desktop.browse doesn't work on Linux with gtk3

See JDK-8275494
This commit is contained in:
Adam
2022-02-13 10:45:44 -05:00
parent 9019d0833b
commit 720b0d0273

View File

@@ -60,18 +60,18 @@ public class LinkBrowser
return; return;
} }
if (attemptDesktopBrowse(url))
{
log.debug("Opened url through Desktop#browse to {}", url);
return;
}
if (shouldAttemptXdg && attemptXdgOpen(url)) if (shouldAttemptXdg && attemptXdgOpen(url))
{ {
log.debug("Opened url through xdg-open to {}", url); log.debug("Opened url through xdg-open to {}", url);
return; return;
} }
if (attemptDesktopBrowse(url))
{
log.debug("Opened url through Desktop#browse to {}", url);
return;
}
log.warn("LinkBrowser.browse() could not open {}", url); log.warn("LinkBrowser.browse() could not open {}", url);
showMessageBox("Unable to open link. Press 'OK' and the link will be copied to your clipboard.", url); showMessageBox("Unable to open link. Press 'OK' and the link will be copied to your clipboard.", url);
}).start(); }).start();
@@ -91,18 +91,18 @@ public class LinkBrowser
return; return;
} }
if (attemptDesktopOpen(directory))
{
log.debug("Opened directory through Desktop#open to {}", directory);
return;
}
if (shouldAttemptXdg && attemptXdgOpen(directory)) if (shouldAttemptXdg && attemptXdgOpen(directory))
{ {
log.debug("Opened directory through xdg-open to {}", directory); log.debug("Opened directory through xdg-open to {}", directory);
return; return;
} }
if (attemptDesktopOpen(directory))
{
log.debug("Opened directory through Desktop#open to {}", directory);
return;
}
log.warn("LinkBrowser.open() could not open {}", directory); log.warn("LinkBrowser.open() could not open {}", directory);
showMessageBox("Unable to open folder. Press 'OK' and the folder directory will be copied to your clipboard.", directory); showMessageBox("Unable to open folder. Press 'OK' and the folder directory will be copied to your clipboard.", directory);
}).start(); }).start();