X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=53b721d3d64ce7f1a57d0eb7ed66ffd82169a69d;hb=e5817172683acab3d5f51789fdf44f7a9106c8dd;hp=e870deaf4a6f3aa183c3eca359c28729dbca66fb;hpb=48fa14983ce103efe05661cbdd08a6811214625b;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index e870dea..53b721d 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -59,9 +59,13 @@ public class AlignFrame Vector alignPanels = new Vector(); - /** DOCUMENT ME!! */ + /** + * Last format used to load or save alignments in this window + */ String currentFileFormat = null; - + /** + * Current filename for this alignment + */ String fileName = null; @@ -692,10 +696,8 @@ public class AlignFrame { JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. getProperty( "LAST_DIRECTORY"), - new String[] - { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","amsa","jar" }, - new String[] - { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview" }, + jalview.io.AppletFormatAdapter.WRITABLE_EXTENSIONS, + jalview.io.AppletFormatAdapter.WRITABLE_FNAMES, currentFileFormat, false); @@ -725,8 +727,11 @@ public class AlignFrame currentFileFormat); jalview.bin.Cache.setProperty("LAST_DIRECTORY", fileName); - - saveAlignment(fileName, currentFileFormat.substring(0,currentFileFormat.indexOf(" "))); + if (currentFileFormat.indexOf(" ")>-1) + { + currentFileFormat = currentFileFormat.substring(0, currentFileFormat.indexOf(" ")); + } + saveAlignment(fileName, currentFileFormat); } } @@ -774,7 +779,7 @@ public class AlignFrame String output = f.formatSequences( format, (Alignment) viewport.alignment, // class cast exceptions will occur in the distant future - omitHidden, f.getCacheSuffixDefault(format)); + omitHidden, f.getCacheSuffixDefault(format), viewport.colSel); if (output == null) { @@ -846,7 +851,7 @@ public class AlignFrame cap.setText(new FormatAdapter().formatSequences( e.getActionCommand(), viewport.alignment, - omitHidden)); + omitHidden, viewport.colSel)); } /** @@ -3320,21 +3325,28 @@ public class AlignFrame { String choice = chooser.getSelectedFile().getPath(); jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); - + jalview.io.NewickFile fin = null; try { - jalview.io.NewickFile fin = new jalview.io.NewickFile(choice, + fin = new jalview.io.NewickFile(choice, "File"); viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree()); } catch (Exception ex) { JOptionPane.showMessageDialog(Desktop.desktop, - "Problem reading tree file", ex.getMessage(), + "Problem reading tree file", JOptionPane.WARNING_MESSAGE); ex.printStackTrace(); } + if (fin!=null && fin.hasWarningMessage()) + { + JOptionPane.showMessageDialog(Desktop.desktop, + fin.getWarningMessage(), + "Possible problem with tree file", + JOptionPane.WARNING_MESSAGE); + } } } @@ -3399,7 +3411,7 @@ public class AlignFrame { ex.printStackTrace(); } - + return tp; } @@ -3617,6 +3629,7 @@ public class AlignFrame } protected void showProductsFor(SequenceI[] sel, Alignment ds, boolean isRegSel, boolean dna, String source) { + ds = this.getViewport().alignment.getDataset(); // update our local dataset reference Alignment prods = CrossRef.findXrefSequences(sel, dna, source, ds); if (prods!=null) { @@ -3624,7 +3637,7 @@ protected void showProductsFor(SequenceI[] sel, Alignment ds, boolean isRegSel, for (int s=0; s