formatting
[jalview.git] / src / jalview / gui / Desktop.java
index 88ab53a..6d8f125 100755 (executable)
@@ -19,7 +19,6 @@
 package jalview.gui;
 
 import jalview.io.*;
-
 import java.awt.*;
 import java.awt.datatransfer.*;
 import java.awt.dnd.*;
@@ -47,6 +46,7 @@ public class Desktop extends jalview.jbgui.GDesktop
     public static jalview.ws.Discoverer discoverer;
 
     public static Object [] jalviewClipboard;
+    public static boolean internalCopy = false;
 
     static int fileLoadingCount= 0;
 
@@ -208,9 +208,11 @@ public class Desktop extends jalview.jbgui.GDesktop
 
               }
 
+
                 public void internalFrameClosed(
                     javax.swing.event.InternalFrameEvent evt)
                 {
+                    PaintRefresher.RemoveComponent(frame);
                     openFrameCount--;
                     windowMenu.remove(menuItem);
                     JInternalFrame itf = desktop.getSelectedFrame();
@@ -244,12 +246,15 @@ public class Desktop extends jalview.jbgui.GDesktop
           frame.setSelected(true);
           frame.requestFocus();
         }catch(java.beans.PropertyVetoException ve)
-        {}
+        {   }
     }
 
     public void lostOwnership(Clipboard clipboard, Transferable contents)
     {
-      Desktop.jalviewClipboard = null;
+      if (!internalCopy)
+        Desktop.jalviewClipboard = null;
+
+      internalCopy = false;
     }
 
     public void dragEnter(DropTargetDragEvent evt)
@@ -308,9 +313,7 @@ public class Desktop extends jalview.jbgui.GDesktop
           }
         }
         catch (Exception e)
-        {
-          e.printStackTrace();
-        }
+        {      }
 
         if (files != null)
         {
@@ -339,9 +342,7 @@ public class Desktop extends jalview.jbgui.GDesktop
             }
           }
           catch (Exception ex)
-          {
-            ex.printStackTrace();
-          }
+          {      }
         }
     }
 
@@ -546,9 +547,7 @@ public class Desktop extends jalview.jbgui.GDesktop
             hb.setDisplayed(true);
         }
         catch (Exception ex)
-        {
-            ex.printStackTrace();
-        }
+        {     }
     }
 
     public void closeAll_actionPerformed(ActionEvent e)
@@ -600,7 +599,6 @@ public class Desktop extends jalview.jbgui.GDesktop
           target = null;
           if(frames[i]==null)
           {
-            System.out.println("its gone");
             continue;
           }
           if (frames[i] instanceof AlignFrame)
@@ -618,14 +616,18 @@ public class Desktop extends jalview.jbgui.GDesktop
             {
               if (close)
                 frames[i].setClosed(true);
-
-              else if (!minimize)
-                frames[i].toFront();
               else
+              {
                 frames[i].setIcon(minimize);
+                if (!minimize)
+                {
+                  frames[i].toFront();
+                }
+              }
+
             }
             catch (java.beans.PropertyVetoException ex)
-            {}
+            {       }
           }
         }
     }
@@ -881,5 +883,15 @@ public class Desktop extends jalview.jbgui.GDesktop
       vamsasStop.setVisible(!b);
 
     }
+    /**
+     * Checks the given url to see if it gives a response indicating that 
+     * the user should be informed of a new questionnaire.
+     * @param url
+     */
+    public void checkForQuestionnaire(String url) {
+        UserQuestionnaireCheck jvq = new UserQuestionnaireCheck(url);
+        javax.swing.SwingUtilities.invokeLater(jvq);
+    }
+
 }