JAL-3446 -- YEIKS! two checkURLLinks calls!
[jalview.git] / src / jalview / gui / Desktop.java
index a13a38b..bbd38ec 100644 (file)
@@ -121,7 +121,6 @@ import jalview.util.BrowserLauncher;
 import jalview.util.ImageMaker.TYPE;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
-import jalview.util.ShortcutKeyMaskExWrapper;
 import jalview.util.UrlConstants;
 import jalview.viewmodel.AlignmentViewport;
 import jalview.ws.params.ParamManager;
@@ -487,8 +486,6 @@ public class Desktop extends GDesktop
           // disabled for SeqCanvasTest
           checkURLLinks();
 
-          checkURLLinks();
-
           // Spawn a thread that shows the splashscreen
 
           SwingUtilities.invokeLater(new Runnable()
@@ -841,7 +838,8 @@ public class Desktop extends GDesktop
           final JInternalFrame frame, String title, int w, int h)
   {
     // 58 classes
-    getInstance().addFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h,
+    
+    addInternalFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h, 
             FRAME_ALLOW_RESIZE, FRAME_SET_MIN_SIZE_300);
   }
 
@@ -869,8 +867,20 @@ public class Desktop extends GDesktop
           final JInternalFrame frame, String title, boolean makeVisible,
           int w, int h, boolean resizable, boolean ignoreMinSize)
   {
-    // 15 classes
-    getInstance().addFrame(frame, title, makeVisible, w, h, resizable,
+    // 15 classes call this method directly.
+    
+    // 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.setSize(w, h);
+    }
+    if (getInstance() != null)
+      getInstance().addFrame(frame, makeVisible, resizable,
             ignoreMinSize);
   }
 
@@ -887,29 +897,11 @@ public class Desktop extends GDesktop
   public final static boolean FRAME_ALLOW_ANY_SIZE = true;
 
   public final static boolean FRAME_SET_MIN_SIZE_300 = false;
-
-  private void addFrame(JInternalFrame frame, String title,
-          boolean makeVisible, int w, int h, boolean resizable,
+  
+  private void addFrame(JInternalFrame frame,
+          boolean makeVisible, 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
-
-    frame.setTitle(title);
-    if (frame.getWidth() < 1 || frame.getHeight() < 1)
-    {
-      frame.setSize(w, h);
-    }
-    // THIS IS A PUBLIC STATIC METHOD, SO IT MAY BE CALLED EVEN IN
-    // A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
-    // IF JALVIEW IS RUNNING HEADLESS
-    // ///////////////////////////////////////////////
-    if (Jalview.isHeadlessMode())
-    {
-      return;
-    }
 
     openFrameCount++;
     
@@ -951,7 +943,7 @@ public class Desktop extends GDesktop
      * add an entry for the new frame in the Window menu 
      * (and remove it when the frame is closed)
      */
-    final JMenuItem menuItem = new JMenuItem(title);
+    final JMenuItem menuItem = new JMenuItem(frame.getTitle());
     frame.addInternalFrameListener(new InternalFrameAdapter()
     {
       @Override