Resolved diffs from 2.8.3
[jalview.git] / src / jalview / gui / AlignViewport.java
index 430f373..e4593a3 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.gui;
 
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+
 import jalview.analysis.AlignmentUtils;
-import jalview.analysis.AlignmentUtils.MappingResult;
 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.analysis.NJTree;
 import jalview.api.AlignViewportI;
@@ -64,18 +75,6 @@ import jalview.util.MessageManager;
 import jalview.viewmodel.AlignmentViewport;
 import jalview.ws.params.AutoCalcSetting;
 
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Rectangle;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-
 /**
  * DOCUMENT ME!
  * 
@@ -93,9 +92,6 @@ public class AlignViewport extends AlignmentViewport implements
 
   int endSeq;
 
-
-  SequenceAnnotationOrder sortAnnotationsBy = null;
-
   Font font;
 
   NJTree currentTree = null;
@@ -842,8 +838,6 @@ public class AlignViewport extends AlignmentViewport implements
 
   private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<String, AutoCalcSetting>();
 
-  private boolean showAutocalculatedAbove;
-
   public AutoCalcSetting getCalcIdSettingsFor(String calcId)
   {
     return calcIdParams.get(calcId);
@@ -862,26 +856,6 @@ public class AlignViewport extends AlignmentViewport implements
     }
   }
 
-  protected SequenceAnnotationOrder getSortAnnotationsBy()
-  {
-    return sortAnnotationsBy;
-  }
-
-  protected void setSortAnnotationsBy(SequenceAnnotationOrder sortAnnotationsBy)
-  {
-    this.sortAnnotationsBy = sortAnnotationsBy;
-  }
-
-  protected boolean isShowAutocalculatedAbove()
-  {
-    return showAutocalculatedAbove;
-  }
-
-  protected void setShowAutocalculatedAbove(boolean showAutocalculatedAbove)
-  {
-    this.showAutocalculatedAbove = showAutocalculatedAbove;
-  }
-
   /**
    * Method called when another alignment's edit (or possibly other) command is
    * broadcast to here.
@@ -951,17 +925,11 @@ public class AlignViewport extends AlignmentViewport implements
      * If one alignment is protein and one nucleotide, with at least one
      * sequence name in common, offer to open a linked alignment.
      */
-    if (getAlignment().isNucleotide() != al.isNucleotide())
+    if (AlignmentUtils.isMappable(al, getAlignment()))
     {
-      // TODO: JAL-845 try a bit harder to link up imported sequences
-      final Set<String> sequenceNames = getAlignment().getSequenceNames();
-      sequenceNames.retainAll(al.getSequenceNames());
-      if (!sequenceNames.isEmpty()) // at least one sequence name in both
+      if (openLinkedAlignment(al, title))
       {
-        if (openLinkedAlignment(al, title))
-        {
-          return;
-        }
+        return;
       }
     }
     // TODO: JAL-407 regardless of above - identical sequences (based on ID and
@@ -1042,21 +1010,11 @@ public class AlignViewport extends AlignmentViewport implements
     }
 
     /*
-     * Try to find mappings for at least one sequence. Any mappings made will be
-     * added to the protein alignment.
+     * Map sequences. At least one should get mapped as we have already passed
+     * the test for 'mappability'. Any mappings made will be added to the
+     * protein alignment.
      */
-    MappingResult mapped = AlignmentUtils.mapProteinToCdna(protein, cdna);
-    if (mapped != MappingResult.Mapped)
-    {
-      /*
-       * No mapping possible - warn the user, but leave window open.
-       */
-      final String msg = JvSwingUtils.wrapTooltip(true,
-              MessageManager.getString("label.mapping_failed"));
-      JOptionPane.showInternalMessageDialog(Desktop.desktop, msg,
-              MessageManager.getString("label.no_mappings"),
-              JOptionPane.WARNING_MESSAGE);
-    }
+    AlignmentUtils.mapProteinToCdna(protein, cdna);
 
     try
     {