New branch created and author list changed to test the commit-function
[jalview.git] / src / jalview / gui / Desktop.java
old mode 100755 (executable)
new mode 100644 (file)
index dbb6955..9797694
@@ -48,10 +48,10 @@ import javax.swing.event.MenuListener;
  * 
  * 
  * @author $author$
- * @version $Revision$
+ * @version $Revision: 1.155 $
  */
 public class Desktop extends jalview.jbgui.GDesktop implements
-        DropTargetListener, ClipboardOwner, IProgressIndicator
+        DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider
 {
 
   private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
@@ -232,9 +232,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     showMemusage.setSelected(selmemusage);
     desktop.setBackground(Color.white);
     getContentPane().setLayout(new BorderLayout());
+    // alternate config - have scrollbars - see notes in JAL-153
+    //JScrollPane sp = new JScrollPane();
+    //sp.getViewport().setView(desktop);
+    //getContentPane().add(sp, BorderLayout.CENTER);
     getContentPane().add(desktop, BorderLayout.CENTER);
-    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
-
+      desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
+      
     // This line prevents Windows Look&Feel resizing all new windows to maximum
     // if previous window was maximised
     desktop.setDesktopManager(new MyDesktopManager(
@@ -631,6 +635,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     } catch (java.beans.PropertyVetoException ve)
     {
     }
+    catch (java.lang.ClassCastException cex)
+    {
+      Cache.log.warn("Squashed a possible GUI implementation error. If you can recreate this, please look at http://issues.jalview.org/browse/JAL-869",cex);
+    }
   }
 
   public void lostOwnership(Clipboard clipboard, Transferable contents)
@@ -943,7 +951,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
     // TODO: update this text for each release or centrally store it for lite
     // and application
-    message.append("\nAuthors:  Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,\n    David Martin & Geoff Barton."
+    message.append("\nAuthors:  Jim Procter, Jan Engelhardt, Lauren Lui, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,\n    David Martin & Geoff Barton."
             + "\nDevelopment managed by The Barton Group, University of Dundee, Scotland, UK.\n"
             + "\nFor help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list\n"
             + "\nIf  you use Jalview, please cite:"
@@ -1174,11 +1182,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
     if (value == JalviewFileChooser.APPROVE_OPTION)
     {
-      java.io.File choice = chooser.getSelectedFile();
+      final Desktop me = this;
+      final java.io.File choice = chooser.getSelectedFile();
+      new Thread(new Runnable()
+      {
+        public void run()
+        {
+
       setProgressBar("Saving jalview project " + choice.getName(),
               choice.hashCode());
       jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
       // TODO catch and handle errors for savestate
+      // TODO prevent user from messing with the Desktop whilst we're saving
       try
       {
         new Jalview2XML().SaveState(choice);
@@ -1191,12 +1206,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         Cache.log
                 .error("Problems whilst trying to save to "
                         + choice.getName(), ex);
-        JOptionPane.showMessageDialog(this,
+        JOptionPane.showMessageDialog(me,
                 "Error whilst saving current state to " + choice.getName(),
                 "Couldn't save project", JOptionPane.WARNING_MESSAGE);
       }
       setProgressBar(null, choice.hashCode());
-
+        }
+      }).start();
     }
   }