JAL-1065 JAL-1066 - refactored tcoffee score-> jalview vis object code to a create...
[jalview.git] / src / jalview / gui / AlignFrame.java
index b3e34fb..2ba0d59 100755 (executable)
@@ -143,8 +143,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   Vector alignPanels = new Vector();
   
-  TCoffeeScoreFile tcoffeeScoreFile;
-
   /**
    * Last format used to load or save alignments in this window
    */
@@ -3886,11 +3884,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                  if( result == null ) { throw new RuntimeException("The file provided does not match the T-Coffee scores file format"); }
 
                  // TODO check that the loaded scores matches the current MSA 'dimension'
-                 changeColour( new TCoffeeColourScheme(result) );
-                 tcoffeeScoreFile = result;
-                 tcoffeeColour.setEnabled(true);
-                 tcoffeeColour.setSelected(true);
-                 
+                 if (result.annotateAlignment(alignPanel.getAlignment(), true))
+                 {
+                         tcoffeeColour.setEnabled(true);
+                         tcoffeeColour.setSelected(true);
+                         // switch to this color
+                         changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+                 } else {
+                   tcoffeeColour.setEnabled(false);
+                   tcoffeeColour.setSelected(false);
+                 }
              } 
              catch (Exception ex) {
                JOptionPane.showMessageDialog(
@@ -3908,9 +3911,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   
   @Override
   protected void tcoffeeColorScheme_actionPerformed(ActionEvent e) {
-         if( tcoffeeScoreFile != null ) {
-         changeColour( new TCoffeeColourScheme(tcoffeeScoreFile) );
-         }
+         changeColour( new TCoffeeColourScheme(alignPanel.getAlignment()) );
   }
   
 //  /**