JAL-3446 from JAL-3253 Discoverers
[jalview.git] / src / jalview / gui / Desktop.java
index 5df48a2..68313e1 100644 (file)
@@ -235,19 +235,19 @@ public class Desktop extends GDesktop
             .getStructureSelectionManager(getInstance());
   }
 
-  static int openFrameCount = 0;
+  int openFrameCount = 0;
 
-  static final int xOffset = 30;
+  final int xOffset = 30;
 
-  static final int yOffset = 30;
+  final int yOffset = 30;
 
-  public static jalview.ws.jws1.Discoverer discoverer;
+  public jalview.ws.jws1.Discoverer discoverer;
 
-  public static Object[] jalviewClipboard;
+  public Object[] jalviewClipboard;
 
-  public static boolean internalCopy = false;
+  public boolean internalCopy = false;
 
-  static int fileLoadingCount = 0;
+  int fileLoadingCount = 0;
 
   class MyDesktopManager implements DesktopManager
   {
@@ -851,16 +851,21 @@ public class Desktop extends GDesktop
           final JInternalFrame frame, String title, boolean makeVisible,
           int w, int h, boolean resizable, boolean ignoreMinSize)
   {
+    
+    getInstance().addFrame(frame, title, makeVisible, w, h, resizable, ignoreMinSize);
+  }
+  
+    private void addFrame(JInternalFrame frame, String title,
+          boolean makeVisible, int w, int h, boolean resizable,
+          boolean ignoreMinSize)
+  {
+      // TODO: allow callers to determine X and Y position of frame (eg. via
+      // bounds object).
+      // TODO: consider fixing method to update entries in the window submenu with
+      // the current window title
 
-
-
-    // TODO: allow callers to determine X and Y position of frame (eg. via
-    // bounds object).
-    // TODO: consider fixing method to update entries in the window submenu with
-    // the current window title
-
-    frame.setTitle(title);
-    if (frame.getWidth() < 1 || frame.getHeight() < 1)
+      frame.setTitle(title);
+      if (frame.getWidth() < 1 || frame.getHeight() < 1)
     {
       frame.setSize(w, h);
     }
@@ -995,7 +1000,6 @@ public class Desktop extends GDesktop
    */
   private static void setKeyBindings(JInternalFrame frame)
   {
-    @SuppressWarnings("serial")
     final Action closeAction = new AbstractAction()
     {
       @Override
@@ -2667,7 +2671,7 @@ public class Desktop extends GDesktop
       // todo: changesupport handlers need to be transferred
       if (discoverer == null)
       {
-        discoverer = new jalview.ws.jws1.Discoverer();
+        discoverer = jalview.ws.jws1.Discoverer.getInstance();
         // register PCS handler for desktop.
         discoverer.addPropertyChangeListener(changeSupport);
       }
@@ -3142,6 +3146,7 @@ public class Desktop extends GDesktop
    *          - the payload from the drop event
    * @throws Exception
    */
+  @SuppressWarnings("unchecked")
   public static void transferFromDropTarget(List<Object> files,
           List<DataSourceType> protocols, DropTargetDropEvent evt,
           Transferable t) throws Exception
@@ -3213,7 +3218,7 @@ public class Desktop extends GDesktop
     {
       // Works on Windows and MacOSX
       Cache.log.debug("Drop handled as javaFileListFlavor");
-      for (Object file : (List) t
+      for (File file : (List<File>) t
               .getTransferData(DataFlavor.javaFileListFlavor))
       {
         files.add(file);