Merge branch 'develop' into task/JAL-4001_migrate_googleanalytics_to_GA4
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 14 Jun 2023 12:41:36 +0000 (13:41 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Wed, 14 Jun 2023 12:41:36 +0000 (13:41 +0100)
1  2 
src/jalview/gui/Desktop.java

@@@ -536,9 -536,6 +536,9 @@@ public class Desktop extends jalview.jb
        setBounds(xPos, yPos, 900, 650);
      }
  
 +    // start dialogue queue for single dialogues
 +    startDialogQueue();
 +
      if (!Platform.isJS())
      /**
       * Java only
        }
      });
      desktop.addMouseListener(ma);
+     if (Platform.isJS())
+     {
+       // used for jalviewjsTest
+       jalview.bin.Console.info("JALVIEWJS: CREATED DESKTOP");
+     }
    }
  
    /**
    /**
     * pause the queue
     */
 -  private java.util.concurrent.Semaphore block = new Semaphore(0);
 +  private Semaphore block = new Semaphore(0);
  
    private static groovy.ui.Console groovyConsole;
  
        {
          if (dialogPause)
          {
 -          try
 -          {
 -            block.acquire();
 -          } catch (InterruptedException x)
 -          {
 -          }
 +          acquireDialogQueue();
          }
          if (instance == null)
          {
      });
    }
  
 +  private boolean dialogQueueStarted = false;
 +
    public void startDialogQueue()
    {
 +    if (dialogQueueStarted)
 +    {
 +      return;
 +    }
      // set the flag so we don't pause waiting for another permit and semaphore
      // the current task to begin
 -    dialogPause = false;
 +    releaseDialogQueue();
 +    dialogQueueStarted = true;
 +  }
 +
 +  public void acquireDialogQueue()
 +  {
 +    try
 +    {
 +      block.acquire();
 +      dialogPause = true;
 +    } catch (InterruptedException e)
 +    {
 +      jalview.bin.Console.debug("Interruption when acquiring DialogueQueue",
 +              e);
 +    }
 +  }
 +
 +  public void releaseDialogQueue()
 +  {
 +    if (!dialogPause)
 +    {
 +      return;
 +    }
      block.release();
 +    dialogPause = false;
    }
  
    /**
      String title = "View of desktop";
      ImageExporter exporter = new ImageExporter(writer, null, TYPE.EPS,
              title);
-     try {
+     try
+     {
        exporter.doExport(of, this, width, height, title);
-     } catch (ImageOutputException ioex) {
-       jalview.bin.Console.error("Unexpected error whilst writing Jalview desktop snapshot as EPS",ioex);
+     } catch (ImageOutputException ioex)
+     {
+       jalview.bin.Console.error(
+               "Unexpected error whilst writing Jalview desktop snapshot as EPS",
+               ioex);
      }
    }
  
     */
    public static void closeDesktop()
    {
-     if (Desktop.instance != null) {
+     if (Desktop.instance != null)
+     {
        Desktop.instance.closeAll_actionPerformed(null);
        Desktop.instance.setVisible(false);
        Desktop.instance.dispose();