JAL-4358 Add the JALVIEW: CREATED DESKTOP line to java app and look out for it in...
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 6 Jun 2024 10:17:41 +0000 (11:17 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 6 Jun 2024 10:17:41 +0000 (11:17 +0100)
getdown/lib/getdown-core.jar
getdown/lib/getdown-launcher-local.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java
j11lib/getdown-core.jar
j8lib/getdown-core.jar
src/jalview/gui/Desktop.java

index b2b4fae..abc2c7a 100644 (file)
Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ
index 149c9e6..368c124 100644 (file)
Binary files a/getdown/lib/getdown-launcher-local.jar and b/getdown/lib/getdown-launcher-local.jar differ
index 6a0f1a1..3e0cb62 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index ed5570c..200e743 100644 (file)
@@ -1050,6 +1050,7 @@ public abstract class Getdown extends Thread
      */
     protected abstract void exit (int exitCode);
 
+    private static boolean _disposed = false;
     /**
      * Copies the supplied stream from the specified input to the specified output. Used to copy
      * our child processes stderr and stdout to our own stderr and stdout.
@@ -1060,6 +1061,19 @@ public abstract class Getdown extends Thread
             BufferedReader reader = new BufferedReader(new InputStreamReader(in));
             String line;
             while ((line = reader.readLine()) != null) {
+                // check for desktop creation line and end early
+                if (!_disposed && line.endsWith("JALVIEW: CREATED DESKTOP")) {
+                  // pump the percent up to 100%
+                  if (_latestInstance != null) {
+                    _latestInstance.setStatusAsync(null, 100, -1L, false);
+                    // only running disposeContainer to remove the visual frame.
+                    // Allow getdown to carry on running until timeout to capture more log lines.
+                    _latestInstance.disposeContainer();
+                    _disposed = true;
+                  } else {
+                    // let nature take its course
+                  }
+                }
                 out.println(line);
                 out.flush();
             }
@@ -1141,6 +1155,11 @@ public abstract class Getdown extends Thread
       
     }
     
+    // set the instance
+    protected static void setInstance(Getdown app) {
+      _latestInstance = app;
+    }
+    
     protected Application _app;
     protected Application.UpdateInterface _ifc = new Application.UpdateInterface(Config.EMPTY);
 
@@ -1179,4 +1198,5 @@ public abstract class Getdown extends Thread
     protected static final int MAX_LOOPS = 5;
     protected static final long FALLBACK_CHECK_TIME = 1000L;
     
+    private static Getdown _latestInstance = null;
 }
index 3eb9450..dbc50db 100644 (file)
@@ -290,6 +290,7 @@ public class GetdownApp
       Application.setStartupFilesFromParameters(getStartupFilesParameters());
     }
  
+    Getdown.setInstance(app);
     app.start();
     return app;
   }
index b2b4fae..abc2c7a 100644 (file)
Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ
index b2b4fae..abc2c7a 100644 (file)
Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ
index fd961eb..878bc39 100644 (file)
@@ -660,11 +660,10 @@ public class Desktop extends jalview.jbgui.GDesktop
     });
     desktop.addMouseListener(ma);
 
-    if (Platform.isJS())
-    {
-      // used for jalviewjsTest
-      jalview.bin.Console.info("JALVIEWJS: CREATED DESKTOP");
-    }
+    // This is important for jalviewjsTest task and also early Getdown
+    // splashscreen removal
+    jalview.bin.Console.info((Platform.isJS() ? "JALVIEWJS" : "JALVIEW")
+            + ": CREATED DESKTOP");
 
   }