X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=bb722a50c87356fff370a471cd05f9b59bfabec7;hb=0a1d49ccc421184b23bcb45cee901f5313913aa1;hp=f483d6fca75a5292c828198392945e89c65add17;hpb=f09f33647e90a6376ffcf096d003afa59f2b41fc;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f483d6f..bb722a5 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -592,7 +592,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener dset.deleteSequence(0); } - firePropertyChange("Alignment", null, null); + firePropertyChange("Alignment", null, viewport.alignment.getSequences()); updateEditMenuBar(); } @@ -676,6 +676,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener public boolean saveAlignment(String file, String format) { + boolean success = true; + if (format.equalsIgnoreCase("Jalview")) { String shortName = title; @@ -686,15 +688,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener java.io.File.separatorChar) + 1); } - new Jalview2XML().SaveAlignment(this, file, shortName); + success = new Jalview2XML().SaveAlignment(this, file, shortName); statusBar.setText("Successfully saved to file: " +fileName+" in " +format +" format."); - - // USE Jalview2XML to save this file - return true; } else { @@ -720,28 +719,37 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener if (output == null) { - return false; - } - - try - { - java.io.PrintWriter out = new java.io.PrintWriter( - new java.io.FileWriter(file)); - - out.print(output); - out.close(); - this.setTitle(file); - statusBar.setText("Successfully saved to file: " - +fileName+" in " - +format +" format."); - return true; + success = false; } - catch (Exception ex) + else { - ex.printStackTrace(); + try + { + java.io.PrintWriter out = new java.io.PrintWriter( + new java.io.FileWriter(file)); + + out.print(output); + out.close(); + this.setTitle(file); + statusBar.setText("Successfully saved to file: " + + fileName + " in " + + format + " format."); + } + catch (Exception ex) + { + success = false; + ex.printStackTrace(); + } } } - return false; + + if (!success) + JOptionPane.showInternalMessageDialog( + this, "Couldn't save file: " + fileName, + "Error Saving File", + JOptionPane.WARNING_MESSAGE); + + return success; } /** @@ -982,7 +990,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener if(originalSource!=null) { originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null; - originalSource.firePropertyChange("alignment", null,null); + originalSource.firePropertyChange("alignment", + null, + originalSource.alignment.getSequences()); } } @@ -1006,7 +1016,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener if(originalSource!=null) { originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null; - originalSource.firePropertyChange("alignment", null,null); + originalSource.firePropertyChange("alignment", + null, + originalSource.alignment.getSequences()); } } @@ -1271,7 +1283,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener } else { - sequences = new FormatAdapter().readFile(str, "Paste", format); + sequences = new FormatAdapter().readFile(str, "Paste", format).getSequencesArray(); } AlignmentI alignment = null; @@ -1550,6 +1562,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false); } + alignPanel.repaint(); + PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); } @@ -2660,9 +2674,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener tp = new TreePanel(alignPanel, type, pwType); } - title = title + " from " + this.title; + title += " from "; + if(viewport.viewName!=null) - title+= " ("+viewport.viewName+")"; + title+= viewport.viewName+" of "; + + title += this.title; Desktop.addInternalFrame(tp, title, 600, 500); } @@ -3270,7 +3287,7 @@ public void drop(DropTargetDropEvent evt) } boolean isAnnotation = new AnnotationFile().readAnnotationFile(viewport. - alignment, file); + alignment, file, protocol); if (!isAnnotation) {