Merge branch 'Jalview-BH/JAL-3026' into
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 1 Nov 2018 10:33:35 +0000 (10:33 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 1 Nov 2018 10:33:35 +0000 (10:33 +0000)
Jalview-BH/JAL-3026-JAL-3063-JAXB

Conflicts:
src/jalview/ext/ensembl/EnsemblRestClient.java
src/jalview/gui/Desktop.java
src/jalview/gui/UserDefinedColours.java
src/jalview/jbgui/GDesktop.java

1  2 
src/jalview/ext/ensembl/EnsemblRestClient.java
src/jalview/gui/Desktop.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/UserDefinedColours.java
src/jalview/jbgui/GDesktop.java

@@@ -20,6 -20,9 +20,7 @@@
   */
  package jalview.ext.ensembl;
  
+ import jalview.bin.Jalview;
 -import jalview.io.DataSourceType;
 -import jalview.io.FileParse;
  import jalview.util.StringUtils;
  
  import java.io.BufferedReader;
@@@ -331,10 -333,10 +332,9 @@@ abstract class EnsemblRestClient extend
      boolean multipleIds = ids != null && ids.size() > 1;
      connection.setRequestMethod(
              multipleIds ? HttpMethod.POST : HttpMethod.GET);
 -    connection.setRequestProperty("Content-Type",
 -            getRequestMimeType(multipleIds));
 +    connection.setRequestProperty("Content-Type", getRequestMimeType());
      connection.setRequestProperty("Accept", getResponseMimeType());
  
-     connection.setUseCaches(false);
      connection.setDoInput(true);
      connection.setDoOutput(multipleIds);
  
@@@ -1736,52 -1717,48 +1733,50 @@@ public class Desktop extends jalview.jb
              "Jalview Project");
      chooser.setFileView(new JalviewFileView());
      chooser.setDialogTitle(MessageManager.getString("label.restore_state"));
-     int value = chooser.showOpenDialog(this);
-     if (value == JalviewFileChooser.APPROVE_OPTION)
+     chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
      {
-       final File selectedFile = chooser.getSelectedFile();
-       setProjectFile(selectedFile);
-       final String choice = selectedFile.getAbsolutePath();
-       Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent());
-       new Thread(new Runnable()
+       @Override
+       public void run()
        {
-         @Override
-         public void run()
+         File selectedFile = chooser.getSelectedFile();
+         setProjectFile(selectedFile);
+         final String choice = selectedFile.getAbsolutePath();
+         Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent());
+         new Thread(new Runnable()
          {
-           setProgressBar(MessageManager.formatMessage(
-                   "label.loading_jalview_project", new Object[]
-                   { choice }), choice.hashCode());
-           try
+           @Override
+           public void run()
            {
-             if (asCastor)
-             {
-               new Jalview2XML().loadJalviewAlign(choice);
-             }
-             else
 -            setProgressBar(MessageManager.formatMessage(
 -                    "label.loading_jalview_project", new Object[]
 -                    { choice }), choice.hashCode());
 -            try
 -            {
 -              new Jalview2XML().loadJalviewAlign(choice);
++              try {
++              if (asCastor)
++              {
++                new Jalview2XML().loadJalviewAlign(choice);
++              }
++              else
++              {
++                new jalview.project.Jalview2XML().loadJalviewAlign(choice);
++              }
+             } catch (OutOfMemoryError oom)
              {
-               new jalview.project.Jalview2XML().loadJalviewAlign(choice);
-             }
-           } catch (OutOfMemoryError oom)
-           {
 -              new OOMWarning("Whilst loading project from " + choice, oom);
 +            new OOMWarning("Whilst loading project from " + choice, oom);
-           } catch (Exception ex)
-           {
+             } catch (Exception ex)
+             {
 -              Cache.log.error(
 -                      "Problems whilst loading project from " + choice, ex);
 -              JvOptionPane.showMessageDialog(Desktop.desktop,
 -                      MessageManager.formatMessage(
 -                              "label.error_whilst_loading_project_from",
 -                              new Object[]
 -                              { choice }),
 -                      MessageManager.getString("label.couldnt_load_project"),
 -                      JvOptionPane.WARNING_MESSAGE);
 +            Cache.log.error(
 +                    "Problems whilst loading project from " + choice, ex);
 +            JvOptionPane.showMessageDialog(Desktop.desktop,
 +                    MessageManager.formatMessage(
 +                            "label.error_whilst_loading_project_from",
 +                            new Object[]
 +                            { choice }),
 +                    MessageManager.getString("label.couldnt_load_project"),
 +                    JvOptionPane.WARNING_MESSAGE);
+             }
 -            setProgressBar(null, choice.hashCode());
            }
-           setProgressBar(null, choice.hashCode());
-         }
-       }).start();
-     }
+         }).start();
+       }
+     });
+     
+     chooser.showOpenDialog(this);
    }
  
    @Override
@@@ -36,11 -35,11 +35,12 @@@ import jalview.io.JalviewFileView
  import jalview.schemes.FeatureColour;
  import jalview.util.MessageManager;
  import jalview.util.Platform;
+ import jalview.util.dialogrunner.RunResponse;
  import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean;
 +import jalview.xml.binding.jalview.JalviewUserColours;
 +import jalview.xml.binding.jalview.JalviewUserColours.Colour;
 +import jalview.xml.binding.jalview.JalviewUserColours.Filter;
 +import jalview.xml.binding.jalview.ObjectFactory;
  
  import java.awt.BorderLayout;
  import java.awt.Color;
@@@ -32,9 -34,7 +32,10 @@@ import jalview.schemes.UserColourScheme
  import jalview.util.ColorUtils;
  import jalview.util.Format;
  import jalview.util.MessageManager;
+ import jalview.util.dialogrunner.RunResponse;
 +import jalview.xml.binding.jalview.JalviewUserColours;
 +import jalview.xml.binding.jalview.JalviewUserColours.Colour;
 +import jalview.xml.binding.jalview.ObjectFactory;
  
  import java.awt.Color;
  import java.awt.Font;
@@@ -459,16 -441,10 +459,15 @@@ public class GDesktop extends JFram
      desktopMenubar.add(windowMenu);
      FileMenu.add(inputMenu);
      FileMenu.add(inputSequence);
-     if (!Jalview.isJS())
 -      FileMenu.addSeparator();
 -      FileMenu.add(saveState);
 -      FileMenu.add(loadState);
 -      FileMenu.addSeparator();
++    FileMenu.addSeparator();
++    FileMenu.add(saveAsJaxb);
++    FileMenu.add(loadAsJaxb);
++    if (!Jalview.isJS()) 
 +    {
-       FileMenu.addSeparator();
 +      FileMenu.add(saveState);
 +      FileMenu.add(loadState);
 +    }
-     FileMenu.add(saveAsJaxb);
-     FileMenu.add(loadAsJaxb);
 +    FileMenu.addSeparator();
      FileMenu.add(quit);
      HelpMenu.add(aboutMenuItem);
      HelpMenu.add(documentationMenuItem);