X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=25c6dd4edb0e0c3fd052a449e01093047b456bfe;hb=8956fdfd008d0d949814c4680a7b3a55969e39e1;hp=936e714291cd805296fa9adf1f68eb297ba50324;hpb=bb6c9d30f57964136b759376b121f121f61c11e6;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 936e714..25c6dd4 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -24,6 +24,7 @@ import jalview.analysis.AlignmentSorter; import jalview.analysis.AlignmentUtils; import jalview.analysis.CrossRef; import jalview.analysis.Dna; +import jalview.analysis.GeneticCodeI; import jalview.analysis.ParseProperties; import jalview.analysis.SequenceIdMatcher; import jalview.api.AlignExportSettingI; @@ -64,6 +65,7 @@ import jalview.gui.ColourMenuHelper.ColourChangeListener; import jalview.gui.ViewSelectionMenu.ViewSetProvider; import jalview.io.AlignmentProperties; import jalview.io.AnnotationFile; +import jalview.io.BackupFiles; import jalview.io.BioJsHTMLOutput; import jalview.io.DataSourceType; import jalview.io.FileFormat; @@ -963,6 +965,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return progressBar.operationInProgress(); } + /** + * Sets the text of the status bar. Note that setting a null or empty value + * will cause the status bar to be hidden, with possibly undesirable flicker + * of the screen layout. + */ @Override public void setStatus(String text) { @@ -1187,9 +1194,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { + // create backupfiles object and get new temp filename destination + BackupFiles backupfiles = new BackupFiles(file); + try { - PrintWriter out = new PrintWriter(new FileWriter(file)); + PrintWriter out = new PrintWriter( + new FileWriter(backupfiles.getTempFilePath())); out.print(output); out.close(); @@ -1202,6 +1213,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, success = false; ex.printStackTrace(); } + + backupfiles.setWriteSuccess(success); + // do the backup file roll and rename the temp file to actual file + success = backupfiles.rollBackupsAndRenameTempFile(); + } } @@ -2403,6 +2419,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, sg.setEndRes(viewport.getAlignment().getWidth() - 1); viewport.setSelectionGroup(sg); + viewport.isSelectionGroupChanged(true); viewport.sendSelection(); // JAL-2034 - should delegate to // alignPanel to decide if overview needs @@ -3033,6 +3050,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.expandColSelection(sg, false); viewport.hideAllSelectedSeqs(); viewport.hideSelectedColumns(); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -3057,6 +3075,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void hideSelColumns_actionPerformed(ActionEvent e) { viewport.hideSelectedColumns(); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -4258,14 +4277,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * frame's DNA sequences to their aligned protein (amino acid) equivalents. */ @Override - public void showTranslation_actionPerformed(ActionEvent e) + public void showTranslation_actionPerformed(GeneticCodeI codeTable) { AlignmentI al = null; try { Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); - al = dna.translateCdna(); + al = dna.translateCdna(codeTable); } catch (Exception ex) { jalview.bin.Cache.log.error( @@ -4294,7 +4313,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, af.setFileFormat(this.currentFileFormat); final String newTitle = MessageManager .formatMessage("label.translation_of_params", new Object[] - { this.getTitle() }); + { this.getTitle(), codeTable.getId() }); af.setTitle(newTitle); if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) {