Open help links in system browser, issue
package net.sf.mzmine.desktop.impl.helpwindow;
+import java.awt.Desktop;
+import java.net.URI;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,6 +39,30 @@ public class HelpWindowController {
@FXML
private WebView helpWebView;
+ @FXML
+ public void initialize() {
+
+ helpWebView.getEngine().locationProperty().addListener((observable, oldValue, newValue) -> {
+
+ // Open external links in system web browser
+ if (newValue.startsWith("http://") || newValue.startsWith("https://")) {
+ try {
+
+ // Open system browser
+ Desktop.getDesktop().browse(new URI(newValue));
+
+ // Stay on the page that is already open
+ helpWebView.getEngine().load(oldValue);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ });
+
+ }
+
@FXML
protected void handleClose(ActionEvent event) {
logger.debug("Closing help window");
@@ -46,4 +73,5 @@ public class HelpWindowController {
return helpWebView.getEngine();
}
+
}
