JAL-4305 Isolate and unify the Jalview object from all the gubbins in jalview.bin...
[jalview.git] / src / jalview / gui / AlignFrame.java
index 25376af..ae14539 100644 (file)
@@ -503,7 +503,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       @Override
       public void focusGained(FocusEvent e)
       {
-        Jalview.setCurrentAlignFrame(AlignFrame.this);
+        Jalview.getInstance().setCurrentAlignFrame(AlignFrame.this);
       }
     });
 
@@ -1252,10 +1252,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    */
   public void saveAlignment(String file, FileFormatI format)
   {
-    saveAlignment(file, format, false);
+    saveAlignment(file, format, false, false);
   }
 
-  public void saveAlignment(String file, FileFormatI format, boolean stdout)
+  public void saveAlignment(String file, FileFormatI format, boolean stdout,
+          boolean forceBackup)
   {
     lastSaveSuccessful = true;
     if (!stdout)
@@ -1308,7 +1309,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       else
       {
         // create backupfiles object and get new temp filename destination
-        boolean doBackup = BackupFiles.getEnabled() && !stdout;
+        boolean doBackup = forceBackup
+                || (BackupFiles.getEnabled() && !stdout);
         BackupFiles backupfiles = null;
         if (doBackup)
         {
@@ -1562,7 +1564,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    */
   public void createPNG(File f) throws ImageOutputException
   {
-    createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing());
+    createPNG(f, null, BitmapImageSizing.defaultBitmapImageSizing());
   }
 
   public void createPNG(File f, String renderer, BitmapImageSizing userBis)
@@ -1669,6 +1671,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       closeAllTabs = true;
     }
 
+    Desktop.closeModal(this);
+
     try
     {
       if (alignPanels != null)
@@ -1698,6 +1702,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           featureSettings.close();
           featureSettings = null;
         }
+
         /*
          * this will raise an INTERNAL_FRAME_CLOSED event and this method will
          * be called recursively, with the frame now in 'closed' state
@@ -1791,7 +1796,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * 
    * @return alignment objects for all views
    */
-  AlignmentI[] getViewAlignments()
+  public AlignmentI[] getViewAlignments()
   {
     if (alignPanels != null)
     {
@@ -5958,8 +5963,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   @Override
   protected void runGroovy_actionPerformed()
   {
-    Jalview.setCurrentAlignFrame(this);
-    groovy.ui.Console console = Desktop.getGroovyConsole();
+    Jalview.getInstance().setCurrentAlignFrame(this);
+    groovy.console.ui.Console console = Desktop.getGroovyConsole();
     if (console != null)
     {
       try