Merge branch 'Release_2_8_0b1_Branch' into try_r20b1_merge
[jalview.git] / src / jalview / gui / Desktop.java
index b2ff85c..5967f5f 100644 (file)
@@ -24,6 +24,7 @@ import jalview.io.FormatAdapter;
 import jalview.io.IdentifyFile;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
+import jalview.util.MessageManager;
 import jalview.ws.params.ParamManager;
 
 import java.awt.BorderLayout;
@@ -648,8 +649,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     // A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
     // IF JALVIEW IS RUNNING HEADLESS
     // ///////////////////////////////////////////////
-    if (System.getProperty("java.awt.headless") != null
-            && System.getProperty("java.awt.headless").equals("true"))
+    if (instance == null || (System.getProperty("java.awt.headless") != null
+            && System.getProperty("java.awt.headless").equals("true")))
     {
       return;
     }
@@ -944,7 +945,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
     // This construct allows us to have a wider textfield
     // for viewing
-    JLabel label = new JLabel("Enter URL of Input File");
+    JLabel label = new JLabel(MessageManager.getString("label.input_file_url"));
     final JComboBox history = new JComboBox();
 
     JPanel panel = new JPanel(new GridLayout(2, 1));
@@ -969,7 +970,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
 
     int reply = JOptionPane.showInternalConfirmDialog(desktop, panel,
-            "Input Alignment From URL", JOptionPane.OK_CANCEL_OPTION);
+            MessageManager.getString("label.input_alignment_from_url"), JOptionPane.OK_CANCEL_OPTION);
 
     if (reply != JOptionPane.OK_OPTION)
     {
@@ -1722,8 +1723,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         if (!vamsasImport(chooser.getSelectedFile()))
         {
           JOptionPane.showInternalMessageDialog(Desktop.desktop,
-                  "Couldn't import '" + fle + "' as a new vamsas session.",
-                  "Vamsas Document Import Failed",
+                  MessageManager.formatMessage("label.couldnt_import_as_vamsas_session", new String[]{fle}),
+                  MessageManager.getString("label.vamsas_document_import_failed"),
                   JOptionPane.ERROR_MESSAGE);
         }
       }
@@ -1866,7 +1867,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
   protected void setupVamsasConnectedGui()
   {
-    vamsasStart.setText("Session Update");
+    vamsasStart.setText(MessageManager.getString("label.session_update"));
     vamsasSave.setVisible(true);
     vamsasStop.setVisible(true);
     vamsasImport.setVisible(false); // Document import to existing session is
@@ -1878,7 +1879,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     vamsasSave.setVisible(false);
     vamsasStop.setVisible(false);
     vamsasImport.setVisible(true);
-    vamsasStart.setText("New Vamsas Session");
+    vamsasStart.setText(MessageManager.getString("label.new_vamsas_session"));
   }
 
   public void vamsasStop_actionPerformed(ActionEvent e)
@@ -2137,9 +2138,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         if (fm != null)
         {
           g.drawString(
-                  "Total Free Memory: " + df.format(totalFreeMemory)
-                          + "MB; Max Memory: " + df.format(maxMemory)
-                          + "MB; " + df.format(percentUsage) + "%", 10,
+                         MessageManager.formatMessage("label.memory_stats", new String[]{df.format(totalFreeMemory),df.format(maxMemory),df.format(percentUsage)}), 10,
                   getHeight() - fm.getHeight());
         }
       }
@@ -2162,7 +2161,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     if (jalview.bin.Cache.groovyJarsPresent())
     {
       groovyShell = new JMenuItem();
-      groovyShell.setText("Groovy Console...");
+      groovyShell.setText(MessageManager.getString("label.groovy_console"));
       groovyShell.addActionListener(new ActionListener()
       {
         public void actionPerformed(ActionEvent e)
@@ -2342,7 +2341,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
     if (handler.canCancel())
     {
-      JButton cancel = new JButton("Cancel");
+      JButton cancel = new JButton(MessageManager.getString("action.cancel"));
       final IProgressIndicator us = this;
       cancel.addActionListener(new ActionListener()
       {
@@ -2437,7 +2436,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
     boolean alive = true;
     Thread t0 = null, t1 = null, t2 = null;
-
+    // JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release
+    if (true)
+    {
     // todo: changesupport handlers need to be transferred
     if (discoverer == null)
     {
@@ -2447,28 +2448,31 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
     // JAL-940 - disabled JWS1 service configuration - always start discoverer
     // until we phase out completely
-    if (true)
-    {
       (t0 = new Thread(discoverer)).start();
     }
 
-    try
+    // ENFIN services are EOLed as of Jalview 2.8.1 release
+    if (false)
     {
-      if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
+      try
       {
-        // EnfinEnvision web service menu entries are rebuild every time the
-        // menu is shown, so no changeSupport events are needed.
-        jalview.ws.EnfinEnvision2OneWay.getInstance();
-        (t1 = new Thread(jalview.ws.EnfinEnvision2OneWay.getInstance()))
-                .start();
+        if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
+        {
+          // EnfinEnvision web service menu entries are rebuild every time the
+          // menu is shown, so no changeSupport events are needed.
+          jalview.ws.EnfinEnvision2OneWay.getInstance();
+          (t1 = new Thread(jalview.ws.EnfinEnvision2OneWay.getInstance()))
+                  .start();
+        }
+      } catch (Exception e)
+      {
+        Cache.log
+                .info("Exception when trying to launch Envision2 workflow discovery.",
+                        e);
+        Cache.log.info(e.getStackTrace());
       }
-    } catch (Exception e)
-    {
-      Cache.log
-              .info("Exception when trying to launch Envision2 workflow discovery.",
-                      e);
-      Cache.log.info(e.getStackTrace());
     }
+
     if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
     {
       if (jalview.ws.jws2.Jws2Discoverer.getDiscoverer().isRunning())