JAL-2629 add ability to add and select a DB for hmmsearch
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
index eef6ee8..c2d19d7 100755 (executable)
@@ -25,6 +25,7 @@ import jalview.api.SplitContainerI;
 import jalview.bin.Cache;
 import jalview.gui.JvSwingUtils;
 import jalview.gui.Preferences;
+import jalview.io.FileFormatException;
 import jalview.io.FileFormats;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
@@ -70,11 +71,25 @@ public class GAlignFrame extends JInternalFrame
 
   protected JMenu hmmerMenu = new JMenu();
 
-  protected JMenuItem hmmAlign = new JMenuItem();
+  protected JMenu hmmAlign = new JMenu();
 
-  protected JMenuItem hmmSearch = new JMenuItem();
+  protected JMenuItem hmmAlignRun = new JMenuItem();
 
-  protected JMenuItem hmmBuild = new JCheckBoxMenuItem();
+  protected JMenuItem hmmAlignSettings = new JMenuItem();
+
+  protected JMenu hmmSearch = new JMenu();
+
+  protected JMenuItem hmmSearchRun = new JMenuItem();
+
+  protected JMenuItem hmmSearchSettings = new JMenuItem();
+
+  protected JMenuItem addDatabase = new JMenuItem();
+
+  protected JMenu hmmBuild = new JMenu();
+
+  protected JMenuItem hmmBuildRun = new JMenuItem();
+
+  protected JMenuItem hmmBuildSettings = new JMenuItem();
 
   protected JMenuItem webServiceNoServices;
 
@@ -1733,49 +1748,123 @@ public class GAlignFrame extends JInternalFrame
         selectHighlightedColumns_actionPerformed(actionEvent);
       }
     };
-    hmmBuild.setText(MessageManager.getString("label.hmmbuild"));
-    hmmBuild.addActionListener(new ActionListener()
+    hmmBuildRun.setText(MessageManager.formatMessage(
+            "label.action_with_default_settings", "hmmbuild"));
+    hmmBuildRun.addActionListener(new ActionListener()
     {
-  
+
       @Override
       public void actionPerformed(ActionEvent e)
       {
         try
         {
-          hmmBuild_actionPerformed(e);
-        } catch (IOException e1)
+          hmmBuildRun_actionPerformed(e);
+        } catch (IOException | InterruptedException e1)
         {
           // TODO Auto-generated catch block
           e1.printStackTrace();
-        } catch (InterruptedException e1)
+        }
+      }
+
+    });
+    hmmBuildSettings.setText(
+            MessageManager.getString("label.edit_settings_and_run"));
+    hmmBuildSettings.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        try
+        {
+          hmmBuildSettings_actionPerformed(e);
+        } catch (IOException | InterruptedException e1)
         {
           // TODO Auto-generated catch block
           e1.printStackTrace();
         }
       }
-  
+
     });
-    hmmAlign.setText(MessageManager.getString("label.hmmalign"));
-    hmmAlign.addActionListener(new ActionListener()
+    hmmAlignRun.setText(MessageManager.formatMessage(
+            "label.action_with_default_settings", "hmmalign"));
+    hmmAlignRun.addActionListener(new ActionListener()
     {
-  
+
       @Override
       public void actionPerformed(ActionEvent e)
       {
         try
         {
-          hmmAlign_actionPerformed(e);
-        } catch (IOException e1)
+          hmmAlignRun_actionPerformed(e);
+        } catch (IOException | InterruptedException e1)
         {
           // TODO Auto-generated catch block
           e1.printStackTrace();
-        } catch (InterruptedException e1)
+        }
+      }
+
+    });
+    hmmAlignSettings.setText(
+            MessageManager.getString("label.edit_settings_and_run"));
+    hmmAlignSettings.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        try
+        {
+          hmmAlignSettings_actionPerformed(e);
+        } catch (IOException | InterruptedException e1)
         {
           // TODO Auto-generated catch block
           e1.printStackTrace();
         }
       }
-  
+
+    });
+    hmmSearchRun.setText(MessageManager.formatMessage(
+            "label.action_with_default_settings", "hmmsearch"));
+    hmmSearchRun.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        hmmSearchRun_actionPerformed(e);
+      }
+
+    });
+    addDatabase.setText(MessageManager.getString("label.add_database"));
+    addDatabase.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        try
+        {
+          addDatabase_actionPerformed(e);
+        } catch (IOException e1)
+        {
+          // TODO Auto-generated catch block
+          e1.printStackTrace();
+        }
+      }
+
+    });
+    hmmSearchSettings.setText(
+            MessageManager.getString("label.edit_settings_and_run"));
+    hmmSearchSettings.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        hmmSearchSettings_actionPerformed(e);
+      }
+
     });
     selectHighlighted.addActionListener(al);
     JMenu tooltipSettingsMenu = new JMenu(
@@ -1968,9 +2057,30 @@ public class GAlignFrame extends JInternalFrame
    */
   protected void initHMMERMenu()
   {
-    hmmAlign = new JMenuItem(MessageManager.getString("label.hmmalign"));
-    hmmBuild = new JMenuItem(MessageManager.getString("label.hmmbuild"));
-    hmmSearch = new JMenuItem(MessageManager.getString("label.hmmsearch"));
+    hmmAlign = new JMenu(MessageManager.getString("label.hmmalign"));
+    hmmAlignSettings = new JMenuItem(
+            MessageManager.getString("label.edit_settings_and_run"));
+    hmmAlignRun = new JMenuItem(MessageManager.formatMessage(
+            "label.action_with_default_settings", "hmmalign"));
+    hmmAlign.add(hmmAlignSettings);
+    hmmAlign.add(hmmAlignRun);
+    hmmBuild = new JMenu(MessageManager.getString("label.hmmbuild"));
+    hmmBuildSettings = new JMenuItem(
+            MessageManager.getString("label.edit_settings_and_run"));
+    hmmBuildRun = new JMenuItem(MessageManager.formatMessage(
+            "label.action_with_default_settings", "hmmbuild"));
+    hmmBuild.add(hmmBuildSettings);
+    hmmBuild.add(hmmBuildRun);
+    hmmSearch = new JMenu(MessageManager.getString("label.hmmsearch"));
+    hmmSearchSettings = new JMenuItem(
+            MessageManager.getString("label.edit_settings_and_run"));
+    hmmSearchRun = new JMenuItem(MessageManager.formatMessage(
+            "label.action_with_default_settings", "hmmsearch"));
+    addDatabase = new JMenuItem(
+            MessageManager.getString("label.add_database"));
+    hmmSearch.add(hmmSearchSettings);
+    hmmSearch.add(hmmSearchRun);
+    hmmSearch.add(addDatabase);
   }
 
   /**
@@ -2457,25 +2567,36 @@ public class GAlignFrame extends JInternalFrame
   {
   }
 
-  protected void autoAlignSeqs_actionPerformed(boolean selected)
+  protected void hmmBuildRun_actionPerformed(ActionEvent e)
+          throws IOException, InterruptedException
   {
   }
 
-  protected void hmmAlign_actionPerformed(ActionEvent e)
-          throws IOException, InterruptedException
+  protected void hmmSearchRun_actionPerformed(ActionEvent e)
+  {
+  }
+
+  protected void addDatabase_actionPerformed(ActionEvent e)
+          throws FileFormatException, IOException
   {
   }
 
-  protected void changeHMMERLocation_actionPerformed(ActionEvent e)
+  protected void hmmAlignRun_actionPerformed(ActionEvent e)
+          throws IOException, InterruptedException
   {
   }
 
-  protected void hmmBuild_actionPerformed(ActionEvent e)
+  protected void hmmBuildSettings_actionPerformed(ActionEvent e)
           throws IOException, InterruptedException
   {
   }
 
-  protected void hmmSearch_actionPerformed(ActionEvent e)
+  protected void hmmSearchSettings_actionPerformed(ActionEvent e)
+  {
+  }
+
+  protected void hmmAlignSettings_actionPerformed(ActionEvent e)
+          throws IOException, InterruptedException
   {
   }