ask user if they want to run the JabaWS tester on new URLs
[jalview.git] / src / jalview / gui / WsPreferences.java
index 45654f2..7ca4fd5 100644 (file)
@@ -143,7 +143,7 @@ public class WsPreferences extends GWsPreferences
   private String editUrl(String initUrl, String title)
   {
     String url=initUrl;
-    URL foo;
+    URL foo=null;
     if (url==null)
     {
       url = "";
@@ -170,7 +170,14 @@ public class WsPreferences extends GWsPreferences
     }
     if (valid && resp==JOptionPane.OK_OPTION)
     {
-      return urltf.getText().trim();
+      int validate = JOptionPane.showInternalConfirmDialog(Desktop.desktop, null, "Validate JabaWS Server ?\n(Look in console output for results)", JOptionPane.YES_NO_OPTION);
+      if (validate == JOptionPane.OK_OPTION)
+      {
+        if (jalview.ws.jws2.Jws2Discoverer.testServiceUrl(foo)) 
+        {
+          return foo.toString();
+        }
+      }
     }
     return initUrl; 
   }