JAL-1764 save Chimera/Jmol state as separate entries in project Jar
[jalview.git] / src / jalview / gui / Desktop.java
index db5bbe5..9e84407 100644 (file)
@@ -169,6 +169,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
   private static final int THREE = 3;
 
+  private static AlignFrame currentAlignFrame;
+
   public static jalview.ws.jws1.Discoverer discoverer;
 
   public static Object[] jalviewClipboard;
@@ -1022,6 +1024,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       {
         new FileLoader().LoadFile(viewport, choice, FormatAdapter.FILE,
                 format);
+        // viewport.setShowSequenceFeatures(JSONFile.isSeqFeaturesEnabled());
+        // AlignFrame af = viewport.getAlignPanel().alignFrame;
+        // if (af != null)
+        // {
+        // af.changeColour(JSONFile.getColourScheme());
+        // af.setMenusForViewport();
+        // }
       }
       else
       {
@@ -1157,7 +1166,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     {
       dialogExecutor.shutdownNow();
     }
-
+    closeAll_actionPerformed(null);
     System.exit(0);
   }
 
@@ -1476,9 +1485,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       final java.io.File choice = chooser.getSelectedFile();
       setProjectFile(choice);
 
-      // TODO or move inside the new Thread?
-      saveChimeraSessions(choice.getAbsolutePath());
-
       new Thread(new Runnable()
       {
         public void run()
@@ -1516,32 +1522,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
   }
 
-  /**
-   * Request any open, linked Chimera sessions to save their state.
-   * 
-   * @param jalviewProjectFilename
-   *          the filename of the Jalview project; Chimera session files should
-   *          be given distinct, but obviously related, names.
-   */
-  public void saveChimeraSessions(String jalviewProjectFilename)
-  {
-    int i = 0;
-    for (JInternalFrame frame : getAllFrames())
-    {
-      if (frame instanceof ChimeraViewFrame)
-      {
-        /*
-         * Construct a filename for the Chimera session by append _chimera<n>.py
-         * to the Jalview project file name.
-         */
-        String chimeraPath = jalviewProjectFilename + "_chimera_" + i
-                + ".py";
-        ((ChimeraViewFrame) frame).saveSession(chimeraPath);
-        i++;
-      }
-    }
-  }
-
   private void setProjectFile(File choice)
   {
     this.projectFile = choice;
@@ -2513,7 +2493,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   public void registerHandler(final long id,
           final IProgressIndicatorHandler handler)
   {
-    if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
+    if (progressBarHandlers == null
+            || !progressBars.containsKey(new Long(id)))
     {
       throw new Error(
               MessageManager
@@ -2981,9 +2962,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
        */
       AlignmentPanel topPanel = (AlignmentPanel) topPanels.get(i);
       AlignFrame newTopFrame = new AlignFrame(topPanel);
+      newTopFrame.setSize(new Dimension(AlignFrame.DEFAULT_WIDTH,
+              AlignFrame.DEFAULT_HEIGHT));
       newTopFrame.setVisible(true);
       AlignmentPanel bottomPanel = (AlignmentPanel) bottomPanels.get(i);
       AlignFrame newBottomFrame = new AlignFrame(bottomPanel);
+      newBottomFrame.setSize(new Dimension(AlignFrame.DEFAULT_WIDTH,
+              AlignFrame.DEFAULT_HEIGHT));
       newBottomFrame.setVisible(true);
       topPanel.av.setGatherViewsHere(false);
       bottomPanel.av.setGatherViewsHere(false);
@@ -3069,4 +3054,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     myTopFrame.setDisplayedView(myTopFrame.alignPanel);
 
   }
+
+  // public static AlignFrame getCurrentAlignFrame()
+  // {
+  // return currentAlignFrame;
+  // }
+  //
+  // public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
+  // {
+  // Desktop.currentAlignFrame = currentAlignFrame;
+  // }
+
+
 }