- return success;
- }
-
- private void warningMessage(String warning, String title)
- {
- if (new jalview.util.Platform().isHeadless())
- {
- System.err.println("Warning: " + title + "\nWarning: " + warning);
+ if (settings.isCancelled())
+ {
+ lastSaveSuccessful = false;
+ return;
+ }
+ AlignmentExportData exportData = settings.getAlignExportData();
+ FormatAdapter f = new FormatAdapter(alignPanel,
+ exportData.getSettings());
+ String output = f.formatSequences(format,
+ exportData.getAlignment(), // class
+ // cast
+ // exceptions
+ // will
+ // occur in the distant future
+ exportData.getOmitHidden(),
+ exportData.getStartEndPostions(),
+ f.getCacheSuffixDefault(format),
+ viewport.getAlignment().getHiddenColumns());
+
+ if (output == null)
+ {
+ lastSaveSuccessful = false;
+ }
+ else
+ {
+ try
+ {
+ PrintWriter out = new PrintWriter(new FileWriter(file));
+
+ out.print(output);
+ out.close();
+ us.setTitle(file);
+ statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_saved_to_file_in_format",
+ new Object[]
+ { fileName, format.getName() }));
+ } catch (Exception ex)
+ {
+ lastSaveSuccessful = false;
+ ex.printStackTrace();
+ }
+ }
+ }
+ });