JAL-1645 source formatting and organise imports
[jalview.git] / src / jalview / appletgui / CutAndPasteTransfer.java
index 1fdbed8..5617c64 100644 (file)
@@ -23,7 +23,6 @@ package jalview.appletgui;
 import jalview.analysis.AlignmentUtils;
 import jalview.api.ComplexAlignFile;
 import jalview.bin.JalviewLite;
-import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.PDBEntry;
@@ -205,8 +204,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
       // TODO: JAL-1102 - should have a warning message in dialog, not simply
       // overwrite the broken input data with the exception
       textarea.setText(MessageManager.formatMessage(
-              "label.could_not_parse_newick_file", new Object[]
-              { ex.getMessage() }));
+              "label.could_not_parse_newick_file",
+              new Object[] { ex.getMessage() }));
       return false;
     }
     return false;
@@ -221,11 +220,11 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
   protected void loadAlignment(String text, boolean newWindow,
           AlignViewport viewport)
   {
-    Alignment al = null;
+    AlignmentI al = null;
 
     String format = new IdentifyFile().Identify(text,
             AppletFormatAdapter.PASTE);
-    AppletFormatAdapter afa = new AppletFormatAdapter(viewport);
+    AppletFormatAdapter afa = new AppletFormatAdapter(alignFrame.alignPanel);
     try
     {
       al = afa.readFile(text, AppletFormatAdapter.PASTE, format);
@@ -294,9 +293,10 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
    * @param al
    * @return
    */
-  protected boolean openSplitFrame(Alignment al, String format)
+  protected boolean openSplitFrame(AlignmentI al, String format)
   {
-    final AlignmentI thisAlignment = this.alignFrame.getAlignViewport().getAlignment();
+    final AlignmentI thisAlignment = this.alignFrame.getAlignViewport()
+            .getAlignment();
     if (thisAlignment.isNucleotide() == al.isNucleotide())
     {
       // both nucleotide or both protein
@@ -325,7 +325,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
     dialog.setMainPanel(question);
     dialog.setVisible(true);
     dialog.toFront();
-    
+
     if (!dialog.accept)
     {
       return false;
@@ -342,8 +342,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
     AlignFrame newFrame = new AlignFrame(al, alignFrame.viewport.applet,
             "Cut & Paste input - " + format, false, false);
     AlignFrame dnaFrame = al.isNucleotide() ? newFrame : copyFrame;
-    AlignFrame proteinFrame = al.isNucleotide() ? copyFrame
-            : newFrame;
+    AlignFrame proteinFrame = al.isNucleotide() ? copyFrame : newFrame;
     SplitFrame sf = new SplitFrame(dnaFrame, proteinFrame);
     sf.addToDisplay(false, applet);
     return true;
@@ -362,8 +361,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
               jalview.io.AppletFormatAdapter.PASTE);
       if (tcf.isValid())
       {
-        if (tcf.annotateAlignment(alignFrame.viewport.getAlignment(),
-                true))
+        if (tcf.annotateAlignment(alignFrame.viewport.getAlignment(), true))
         {
           alignFrame.tcoffeeColour.setEnabled(true);
           alignFrame.alignPanel.fontChanged();
@@ -378,8 +376,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
           // file valid but didn't get added to alignment for some reason
           alignFrame.statusBar.setText(MessageManager.formatMessage(
                   "label.failed_add_tcoffee_scores",
-                  new Object[]
-                  { (tcf.getWarningMessage() != null ? tcf
+                  new Object[] { (tcf.getWarningMessage() != null ? tcf
                           .getWarningMessage() : "") }));
         }
       }
@@ -394,8 +391,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
     if (tcf == null)
     {
       if (new AnnotationFile().annotateAlignmentView(alignFrame.viewport,
-              textarea.getText(),
-              jalview.io.AppletFormatAdapter.PASTE))
+              textarea.getText(), jalview.io.AppletFormatAdapter.PASTE))
       {
         alignFrame.alignPanel.fontChanged();
         alignFrame.alignPanel.setScrollValues(0, 0);
@@ -430,13 +426,13 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
 
     if (alignFrame.alignPanel.av.applet.jmolAvailable)
     {
-      new jalview.appletgui.AppletJmol(pdb, new SequenceI[]
-      { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE);
+      new jalview.appletgui.AppletJmol(pdb, new SequenceI[] { seq }, null,
+              alignFrame.alignPanel, AppletFormatAdapter.PASTE);
     }
     else
     {
-      new MCview.AppletPDBViewer(pdb, new SequenceI[]
-      { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE);
+      new MCview.AppletPDBViewer(pdb, new SequenceI[] { seq }, null,
+              alignFrame.alignPanel, AppletFormatAdapter.PASTE);
     }
   }