JAL-1379 JAL-1358 only enable/disable menu entries associated with services not appli...
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Sat, 5 Oct 2013 11:13:12 +0000 (12:13 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Sat, 5 Oct 2013 11:13:45 +0000 (12:13 +0100)
src/jalview/ws/jws2/SequenceAnnotationWSClient.java

index cca6af3..59cc962 100644 (file)
@@ -301,42 +301,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
     {
       final JCheckBoxMenuItem aaConEnabled = new JCheckBoxMenuItem(
               aaui.getAAconToggle());
-      wsmenu.addMenuListener(new MenuListener()
-      {
 
-        @Override
-        public void menuSelected(MenuEvent arg0)
-        {
-          // TODO: refactor to the implementing class.
-          wsmenu.setEnabled((alignFrame.getViewport().getAlignment()
-                  .isNucleotide() ? aaui.isNa() : aaui.isPr()));
-          List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
-                  .getCalcManager()
-                  .getRegisteredWorkersOfClass(aaui.getClient());
-          if (aaconClient != null && aaconClient.size() > 0)
-          {
-            aaConEnabled.setSelected(true);
-          }
-          else
-          {
-            aaConEnabled.setSelected(false);
-          }
-        }
-
-        @Override
-        public void menuDeselected(MenuEvent arg0)
-        {
-          // TODO Auto-generated method stub
-
-        }
-
-        @Override
-        public void menuCanceled(MenuEvent arg0)
-        {
-          // TODO Auto-generated method stub
-
-        }
-      });
       aaConEnabled.setToolTipText("<html><p>"
               + JvSwingUtils.wrapTooltip(aaui.getAAconToggleTooltip() + "</p>")
               + "</html>");
@@ -361,7 +326,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
 
       });
       wsmenu.add(aaConEnabled);
-      JMenuItem modifyParams = new JMenuItem(aaui.getAAeditSettings());
+      final JMenuItem modifyParams = new JMenuItem(aaui.getAAeditSettings());
       modifyParams.setToolTipText("<html><p>"
               + JvSwingUtils.wrapTooltip(aaui.getAAeditSettingsTooltip() + "</p>")
               + "</html>");
@@ -375,6 +340,49 @@ public class SequenceAnnotationWSClient extends Jws2Client
         }
       });
       wsmenu.add(modifyParams);
+      wsmenu.addMenuListener(new MenuListener()
+      {
+
+        @Override
+        public void menuSelected(MenuEvent arg0)
+        {
+          // TODO: refactor to the implementing class.
+          if (alignFrame.getViewport().getAlignment()
+                  .isNucleotide() ? aaui.isNa() : aaui.isPr()) {
+            aaConEnabled.setEnabled(true);
+            modifyParams.setEnabled(true);
+          }
+          else {
+            aaConEnabled.setEnabled(false);
+            modifyParams.setEnabled(false);
+          }
+          List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
+                  .getCalcManager()
+                  .getRegisteredWorkersOfClass(aaui.getClient());
+          if (aaconClient != null && aaconClient.size() > 0)
+          {
+            aaConEnabled.setSelected(true);
+          }
+          else
+          {
+            aaConEnabled.setSelected(false);
+          }
+        }
+
+        @Override
+        public void menuDeselected(MenuEvent arg0)
+        {
+          // TODO Auto-generated method stub
+
+        }
+
+        @Override
+        public void menuCanceled(MenuEvent arg0)
+        {
+          // TODO Auto-generated method stub
+
+        }
+      });
 
     }
     return true;