JAL-1760 JAL-1641 Serialisation of Hidden Seqs and Cols in JSON output. Added ability...
[jalview.git] / src / jalview / gui / CutAndPasteTransfer.java
index 22f0a59..6f15ddf 100644 (file)
 package jalview.gui;
 
 import jalview.datamodel.Alignment;
+import jalview.io.FileParse;
 import jalview.io.FormatAdapter;
+import jalview.io.HtmlFile;
 import jalview.io.IdentifyFile;
+import jalview.io.JSONFile;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
 import jalview.jbgui.GCutAndPasteTransfer;
@@ -53,6 +56,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
 
   AlignViewport viewport;
 
+  FileParse source = null;
   public CutAndPasteTransfer()
   {
     SwingUtilities.invokeLater(new Runnable()
@@ -188,7 +192,10 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
     {
       try
       {
-        al = new FormatAdapter().readFile(getText(), "Paste", format);
+        FormatAdapter fa = new FormatAdapter(viewport);
+        al = fa.readFile(getText(), "Paste", format);
+        source = fa.getAlignFile();
+
       } catch (java.io.IOException ex)
       {
         JOptionPane.showInternalMessageDialog(Desktop.desktop,
@@ -219,6 +226,16 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
         af.statusBar.setText(MessageManager
                 .getString("label.successfully_pasted_alignment_file"));
 
+        if (source instanceof HtmlFile)
+        {
+          ((HtmlFile) source).applySettingsToAlignmentView(af);
+        }
+        else if (source instanceof JSONFile)
+        {
+          ((JSONFile) source).applySettingsToAlignmentView(af);
+        }
+
+
         try
         {
           af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN",
@@ -230,6 +247,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
     }
   }
 
+
   /**
    * DOCUMENT ME!
    *