Merge branch 'JAL-3878_ws-overhaul-3' into mmw/Release_2_12_ws_merge
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Mon, 6 Feb 2023 13:04:59 +0000 (14:04 +0100)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Mon, 6 Feb 2023 13:10:03 +0000 (14:10 +0100)
1  2 
src/jalview/datamodel/Sequence.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/Desktop.java
src/jalview/gui/PCAPanel.java
src/jalview/gui/SlivkaPreferences.java
src/jalview/gui/StructureChooser.java
src/jalview/gui/WebserviceInfo.java
src/jalview/gui/WsJobParameters.java
src/jalview/viewmodel/AlignmentViewport.java
src/jalview/workers/AlignCalcManager2.java

Simple merge
@@@ -4648,11 -4664,12 +4668,12 @@@ public class AlignFrame extends GAlignF
        webService.removeAll();
        if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true))
        {
 -        Cache.log.info("Building web service menu for slivka");
 +        Console.info("Building web service menu for slivka");
          SlivkaWSDiscoverer discoverer = SlivkaWSDiscoverer.getInstance();
-         JMenu submenu = new JMenu("Slivka");
-         buildWebServicesMenu(discoverer, submenu);
-         webService.add(submenu);
+         slivkaMenu.setServices(discoverer);
+         slivkaMenu.setInProgress(discoverer.isRunning());
+         slivkaMenu.setNoServices(discoverer.isDone() && !discoverer.hasServices());
+         webService.add(slivkaMenu.getMenu());
        }
        if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
        {
Simple merge
Simple merge
@@@ -38,6 -33,11 +33,11 @@@ import javax.swing.UIManager
  import javax.swing.table.AbstractTableModel;
  import javax.swing.table.DefaultTableCellRenderer;
  
 -import jalview.bin.Cache;
++import jalview.bin.Console;
+ import jalview.util.MessageManager;
+ import jalview.ws2.client.api.WebServiceDiscovererI;
+ import jalview.ws2.client.slivka.SlivkaWSDiscoverer;
  @SuppressWarnings("serial")
  public class SlivkaPreferences extends JPanel
  {
    // Discoverer buttons action listeners
    private ActionListener refreshServicesAction = (ActionEvent e) -> {
      progressBar.setVisible(true);
 -    Cache.log.info("Requesting service reload");
 +    Console.info("Requesting service reload");
-     discoverer.startDiscoverer().handle((_discoverer, exception) -> {
+     discoverer.startDiscoverer().handle((services, exception) -> {
        if (exception == null)
        {
 -        Cache.log.info("Reloading done");
 +        Console.info("Reloading done");
        }
-       else
+       else if (exception instanceof CancellationException)
        {
 -        Cache.log.info("Reloading cancelled");
++        Console.info("Reloading cancelled");
+       }
+       else {
 -        Cache.log.error("Reloading failed", exception);
 +        Console.error("Reloading failed", exception);
        }
        SwingUtilities.invokeLater(() -> progressBar.setVisible(false));
        return null;
Simple merge
Simple merge
Simple merge
@@@ -106,24 -105,20 +106,20 @@@ public class AlignCalcManager2 implemen
          throw new IllegalStateException(
                  "Cannot submit new task if the prevoius one is still running");
        }
 -      Cache.log.debug(
 -              format("Worker %s queued", getWorker().getClass().getName()));
 +      Console.debug(
-               format("Worker %s queued", getWorker().getClass().getName()));
++              format("Worker %s queued", getWorker()));
        task = executor.submit(() -> {
          try
          {
-           Console.debug(format("Worker %s started",
-                   getWorker().getClass().getName()));
 -          Cache.log.debug(format("Worker %s started", getWorker()));
++          Console.debug(format("Worker %s started", getWorker()));
            getWorker().run();
-           Console.debug(format("Worker %s finished",
-                   getWorker().getClass().getName()));
 -          Cache.log.debug(format("Worker %s finished", getWorker()));
++          Console.debug(format("Worker %s finished", getWorker()));
          } catch (InterruptedException e)
          {
-           Console.debug(format("Worker %s interrupted",
-                   getWorker().getClass().getName()));
 -          Cache.log.debug(format("Worker %s interrupted", getWorker()));
++          Console.debug(format("Worker %s interrupted", getWorker()));
          } catch (Throwable th)
          {
-           Console.debug(format("Worker %s failed",
-                   getWorker().getClass().getName()), th);
 -          Cache.log.debug(format("Worker %s failed", getWorker()), th);
++          Console.debug(format("Worker %s failed", getWorker()), th);
          } finally
          {
            if (!isRegistered())
        {
          return;
        }
-       Console.debug(format("Cancelling worker %s",
-               getWorker().getClass().getName()));
 -      Cache.log.debug(format("Cancelling worker %s", getWorker()));
++      Console.debug(format("Cancelling worker %s", getWorker()));
        task.cancel(true);
      }
    }
        if (task != null && !(task.isDone() || task.isCancelled()))
        {
          throw new IllegalStateException(
--                "Cannot submit new task if the prevoius one is still running");
++                "Cannot submit new task if the previous one is still running");
        }
-       Console.debug(
-               format("Worker %s queued", getWorker().getClass().getName()));
 -      Cache.log.debug(
 -              format("Worker %s queued", getWorker()));
++      Console.debug( format("Worker %s queued", getWorker()));
        final var runnable = new Runnable()
        {
          private boolean started = false;
            {
              if (!started)
              {
-               Console.debug(format("Worker %s started",
-                       getWorker().getClass().getName()));
 -              Cache.log.debug(format("Worker %s started", getWorker()));
++              Console.debug(format("Worker %s started", getWorker()));
                getWorker().startUp();
                started = true;
              }
              else if (!completed)
              {
-               Console.debug(format("Polling worker %s",
-                       getWorker().getClass().getName()));
 -              Cache.log.debug(format("Polling worker %s", getWorker()));
++              Console.debug(format("Polling worker %s", getWorker()));
                if (getWorker().poll())
                {
-                 Console.debug(format("Worker %s finished",
-                         getWorker().getClass().getName()));
 -                Cache.log.debug(format("Worker %s finished", getWorker()));
++                Console.debug(format("Worker %s finished", getWorker()));
                  completed = true;
                }
              }
            } catch (Throwable th)
            {
-             Console.debug(format("Worker %s failed",
-                     getWorker().getClass().getName()), th);
 -            Cache.log.debug(format("Worker %s failed", getWorker()), th);
++            Console.debug(format("Worker %s failed", getWorker()), th);
              completed = true;
            }
            if (completed)
              final var worker = getWorker();
              if (!isRegistered())
                PollableWorkerManager.super.worker = null;
-             Console.debug(format("Finalizing completed worker %s",
-                     worker.getClass().getName()));
 -            Cache.log.debug(format("Finalizing completed worker %s", worker));
++            Console.debug(format("Finalizing completed worker %s", worker));
              worker.done();
              // almost impossible, but the future may be null at this point
              // let it throw NPE to cancel forcefully
        {
          return;
        }
-       Console.debug(format("Cancelling worker %s",
-               getWorker().getClass().getName()));
 -      Cache.log.debug(format("Cancelling worker %s", getWorker()));
++      Console.debug(format("Cancelling worker %s", getWorker()));
        task.cancel(false);
        executor.submit(() -> {
          final var worker = getWorker();
          if (worker != null)
          {
            worker.cancel();
-           Console.debug(format("Finalizing cancelled worker %s",
-                   worker.getClass().getName()));
 -          Cache.log.debug(format("Finalizing cancelled worker %s", worker));
++          Console.debug(format("Finalizing cancelled worker %s", worker));
            worker.done();
          }
        });