JAL-3048 JS-compatible confirm dialog on delete all
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
index 3a6e603..5940172 100755 (executable)
@@ -23,7 +23,6 @@ package jalview.jbgui;
 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.api.SplitContainerI;
 import jalview.bin.Cache;
-import jalview.bin.Jalview;
 import jalview.gui.JvSwingUtils;
 import jalview.gui.Preferences;
 import jalview.io.FileFormats;
@@ -236,7 +235,7 @@ public class GAlignFrame extends JInternalFrame
       System.err.println(e.toString());
     }
 
-    if (!Platform.isAMac())
+    if (Platform.allowMnemonics()) // was "not mac and not JS"
     {
       closeMenuItem.setMnemonic('C');
       outputTextboxMenu.setMnemonic('T');
@@ -285,16 +284,7 @@ public class GAlignFrame extends JInternalFrame
     addMenuActionAndAccelerator(keyStroke, closeMenuItem, al);
 
     JMenu editMenu = new JMenu(MessageManager.getString("action.edit"));
-    JMenu viewMenu = new JMenu(MessageManager.getString("action.view")) {
-      
-      public void setPopupMenuVisible(boolean b) {
-        if (b) {
-          openFeatureSettings.setEnabled(haveAlignmentFeatures());
-        }
-        super.setPopupMenuVisible(b);
-      }
-
-    };
+    JMenu viewMenu = new JMenu(MessageManager.getString("action.view"));
     JMenu annotationsMenu = new JMenu(
             MessageManager.getString("action.annotations"));
     JMenu showMenu = new JMenu(MessageManager.getString("action.show"));
@@ -979,7 +969,7 @@ public class GAlignFrame extends JInternalFrame
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        copy_actionPerformed(e);
+        copy_actionPerformed();
       }
     };
     addMenuActionAndAccelerator(keyStroke, copy, al);
@@ -992,7 +982,7 @@ public class GAlignFrame extends JInternalFrame
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        cut_actionPerformed(e);
+        cut_actionPerformed();
       }
     };
     addMenuActionAndAccelerator(keyStroke, cut, al);
@@ -1004,7 +994,7 @@ public class GAlignFrame extends JInternalFrame
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        delete_actionPerformed(e);
+        delete_actionPerformed();
       }
     });
 
@@ -1293,7 +1283,6 @@ public class GAlignFrame extends JInternalFrame
 
     openFeatureSettings = new JMenuItem(
             MessageManager.getString("action.feature_settings"));
-    openFeatureSettings.setEnabled(false);
     openFeatureSettings.addActionListener(new ActionListener()
     {
       @Override
@@ -1302,6 +1291,10 @@ public class GAlignFrame extends JInternalFrame
         featureSettings_actionPerformed(e);
       }
     });
+
+    /*
+     * add sub-menu of database we can fetch from
+     */
     JMenuItem fetchSequence = new JMenuItem(
             MessageManager.getString("label.fetch_sequences"));
     fetchSequence.addActionListener(new ActionListener()
@@ -1309,7 +1302,7 @@ public class GAlignFrame extends JInternalFrame
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        fetchSequence_actionPerformed(e);
+        fetchSequence_actionPerformed();
       }
     });
 
@@ -1717,7 +1710,7 @@ public class GAlignFrame extends JInternalFrame
     alignFrameMenuBar.add(formatMenu);
     alignFrameMenuBar.add(colourMenu);
     alignFrameMenuBar.add(calculateMenu);
-    if (!Jalview.isJS())
+    if (!Platform.isJS())
     {
       alignFrameMenuBar.add(webService);
     }
@@ -1738,7 +1731,7 @@ public class GAlignFrame extends JInternalFrame
     fileMenu.add(exportAnnotations);
     fileMenu.add(loadTreeMenuItem);
     fileMenu.add(associatedData);
-    if (!Jalview.isJS())
+    if (!Platform.isJS())
     {
       fileMenu.add(loadVcf);
     }
@@ -1775,11 +1768,8 @@ public class GAlignFrame extends JInternalFrame
     hideMenu.add(hideAllSelection);
     hideMenu.add(hideAllButSelection);
     viewMenu.add(newView);
-    if (!Jalview.isJS())
-    {
-      viewMenu.add(expandViews);
-      viewMenu.add(gatherViews);
-    }
+    viewMenu.add(expandViews);
+    viewMenu.add(gatherViews);
     viewMenu.addSeparator();
     viewMenu.add(showMenu);
     viewMenu.add(hideMenu);
@@ -1839,7 +1829,7 @@ public class GAlignFrame extends JInternalFrame
     calculateMenu.addSeparator();
     calculateMenu.add(expandAlignment);
     calculateMenu.add(extractScores);
-    if (!Jalview.isJS())
+    if (!Platform.isJS())
     {
       calculateMenu.addSeparator();
       calculateMenu.add(runGroovy);
@@ -1848,15 +1838,15 @@ public class GAlignFrame extends JInternalFrame
     webServiceNoServices = new JMenuItem(
             MessageManager.getString("label.no_services"));
     webService.add(webServiceNoServices);
-    if (!Jalview.isJS())
+    if (!Platform.isJS())
     {
       exportImageMenu.add(htmlMenuItem);
     }
     exportImageMenu.add(epsFile);
     exportImageMenu.add(createPNG);
-    exportImageMenu.add(createBioJS);
-    if (!Jalview.isJS())
+    if (!Platform.isJS())
     {
+      exportImageMenu.add(createBioJS);
       exportImageMenu.add(createSVG);
     }
     addSequenceMenu.add(addFromFile);
@@ -1899,12 +1889,6 @@ public class GAlignFrame extends JInternalFrame
     // selectMenu.add(listenToViewSelections);
   }
 
-  protected boolean haveAlignmentFeatures()
-  {
-    // because gAlignFrame is not an abstract class  -- see AlignFrame
-    return false;
-  }
-
   protected void loadVcf_actionPerformed()
   {
   }
@@ -2367,15 +2351,15 @@ public class GAlignFrame extends JInternalFrame
   {
   }
 
-  protected void copy_actionPerformed(ActionEvent e)
+  protected void copy_actionPerformed()
   {
   }
 
-  protected void cut_actionPerformed(ActionEvent e)
+  protected void cut_actionPerformed()
   {
   }
 
-  protected void delete_actionPerformed(ActionEvent e)
+  protected void delete_actionPerformed()
   {
   }
 
@@ -2487,7 +2471,7 @@ public class GAlignFrame extends JInternalFrame
 
   }
 
-  public void fetchSequence_actionPerformed(ActionEvent e)
+  public void fetchSequence_actionPerformed()
   {
 
   }