X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;fp=src%2Fjalview%2Fgui%2FAlignFrame.java;h=221d52c4918642cb15933a1e34284041fda6044d;hb=6a3f4318037072a77588afb951a5a53835d5da99;hp=3ba73192be43525bca54f8dce58871939b09e35b;hpb=1379350f04bc63ca05bd428afb86717c4764755d;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 3ba7319..221d52c 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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 */ @@ -3884,6 +3882,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { TCoffeeScoreFile result = TCoffeeScoreFile.load(new File(sFilePath)); if( result == null ) { + // TODO: raise a dialog box here rather than bomb out. + throw new RuntimeException("The file provided does not match the T-Coffee scores file format"); } @@ -3892,14 +3892,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ AlignmentI aln; if( (aln=viewport.alignment) != null && (aln.getHeight() != result.getHeight() || aln.getWidth() != result.getWidth()) ) { - throw new RuntimeException("The scores matrix does not match the alignment dimensions"); + // TODO: raise a dialog box here rather than bomb out. + throw new RuntimeException("The scores matrix does not match the alignment dimensions"); } - - 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( @@ -3917,9 +3922,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()) ); } // /**