Jalview 2.6 source licence
[jalview.git] / src / jalview / ws / jws2 / MsaWSClient.java
index 7df3a98..f3c385a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
@@ -151,7 +151,8 @@ public class MsaWSClient extends Jws2Client
     {
       if (sh.paramStore == null)
       {
-        sh.paramStore = new JabaParamStore(sh);
+        sh.paramStore = new JabaParamStore(sh,
+                Desktop.getUserParameterStore());
       }
       WsJobParameters jobParams = new WsJobParameters(sh, preset);
       if (!jobParams.showRunDialog())
@@ -270,17 +271,21 @@ public class MsaWSClient extends Jws2Client
       rmsawsmenu.add(msawsmenu);
       calcName = "";
     }
-
+    boolean hasparams = service.hasParameters();
     do
     {
+      String action="Align ";
       if (submitGaps == true)
       {
-        msawsmenu = new JMenu("profile " + svcname);
+        action="Realign ";
+        msawsmenu = new JMenu("Realign with " + svcname);
+        msawsmenu.setToolTipText("Align sequences to an existing alignment");
         rmsawsmenu.add(msawsmenu);
       }
       final boolean withGaps = submitGaps;
+
       JMenuItem method = new JMenuItem(calcName + "Defaults");
-      method.setToolTipText("Align with default settings");
+      method.setToolTipText(action+"with default settings");
 
       method.addActionListener(new ActionListener()
       {
@@ -294,48 +299,54 @@ public class MsaWSClient extends Jws2Client
         }
       });
       msawsmenu.add(method);
-      method = new JMenuItem(calcName + "Edit and run ...");
-      method.setToolTipText("View and change the parameters before alignment.");
-
-      method.addActionListener(new ActionListener()
+      if (hasparams)
       {
-        public void actionPerformed(ActionEvent e)
-        {
-          AlignmentView msa = alignFrame.gatherSequencesForAlignment();
-          new MsaWSClient(service, null, null, true, alignFrame.getTitle(),
-                  msa, withGaps, true, alignFrame.getViewport()
-                          .getAlignment().getDataset(), alignFrame);
+        // only add these menu options if the service has user-modifiable arguments
+        method = new JMenuItem(calcName + "Edit and run ...");
+        method.setToolTipText("View and change the parameters before alignment.");
 
-        }
-      });
-      msawsmenu.add(method);
-      List<WsParamSetI> presets = service.getParamStore().getPresets();
-      if (presets != null && presets.size() > 0)
-      {
-        JMenu presetlist = new JMenu(calcName + "Presets");
+        method.addActionListener(new ActionListener()
+        {
+          public void actionPerformed(ActionEvent e)
+          {
+            AlignmentView msa = alignFrame.gatherSequencesForAlignment();
+            new MsaWSClient(service, null, null, true, alignFrame
+                    .getTitle(), msa, withGaps, true, alignFrame
+                    .getViewport().getAlignment().getDataset(), alignFrame);
 
-        for (final WsParamSetI preset : presets)
+          }
+        });
+        msawsmenu.add(method);
+        List<WsParamSetI> presets = service.getParamStore().getPresets();
+        if (presets != null && presets.size() > 0)
         {
-          final JMenuItem methodR = new JMenuItem(preset.getName());
-          methodR.setToolTipText("<html><p><strong>"
-                  + (preset.isModifiable() ? "User Preset"
-                          : "Service Preset") + "</strong><br/>"
-                  + preset.getDescription() + "</p></html>");
-          methodR.addActionListener(new ActionListener()
+          JMenu presetlist = new JMenu(calcName + "Presets");
+
+          for (final WsParamSetI preset : presets)
           {
-            public void actionPerformed(ActionEvent e)
+            final JMenuItem methodR = new JMenuItem(preset.getName());
+            methodR.setToolTipText("<html><p>"
+                    + JvSwingUtils.wrapTooltip("<strong>"
+                            + (preset.isModifiable() ? "User Preset"
+                                    : "Service Preset") + "</strong><br/>"
+                            + preset.getDescription() + "</p>") + "</html>");
+            methodR.addActionListener(new ActionListener()
             {
-              AlignmentView msa = alignFrame.gatherSequencesForAlignment();
-              new MsaWSClient(service, preset, alignFrame.getTitle(), msa,
-                      false, true, alignFrame.getViewport().getAlignment()
-                              .getDataset(), alignFrame);
+              public void actionPerformed(ActionEvent e)
+              {
+                AlignmentView msa = alignFrame
+                        .gatherSequencesForAlignment();
+                new MsaWSClient(service, preset, alignFrame.getTitle(),
+                        msa, false, true, alignFrame.getViewport()
+                                .getAlignment().getDataset(), alignFrame);
 
-            }
+              }
 
-          });
-          presetlist.add(methodR);
+            });
+            presetlist.add(methodR);
+          }
+          msawsmenu.add(presetlist);
         }
-        msawsmenu.add(presetlist);
       }
       if (!submitGaps && canSubmitGaps())
       {