action.cluster_matrix_tooltip = Computes an average distance tree for the matrix and displays it
label.all_known_alignment_files = All known alignment files
label.by_extension = By extension
-label.by_extension_tooltip = File will be saved in a format corresponding to the given file extension (if the extension is recognised)
+label.by_extension_tooltip = File will be saved in a format corresponding to the given file extension
label.command_line_arguments = Command Line Arguments
warning.using_old_command_line_arguments = It looks like you are using old command line arguments. These are now deprecated and will be removed in a future release of Jalview.\nFind out about the new command line arguments at\n
warning.using_mixed_command_line_arguments = Jalview cannot use both old (-arg) and new (--arg) command line arguments. Please check your command line arguments.\ne.g. {0} and {1}
prompt.analytics = ¿Quiere ayudar a mejorar Jalview habilitando la recopilación de estadísticas de uso con análisis Plausible?\nPuede habilitar o deshabilitar el seguimiento de uso en las preferencias.
label.all_known_alignment_files = Todos los archivos de alineación conocidos
label.by_extension = Por extensión
-label.by_extension_tooltip = El archivo se guardará en un formato correspondiente a la extensión de archivo indicada (si se reconoce la extensión)
+label.by_extension_tooltip = El archivo se guardará en un formato correspondiente a la extensión de archivo indicada
label.command_line_arguments = Argumentos de línea de comando
warning.using_old_command_line_arguments = Parece que estás utilizando argumentos antiguos de línea de comando. Estos ahora están en desuso y se eliminarán en una versión futura de Jalview.\nObtenga más información sobre los nuevos argumentos de la línea de comando en\n
warning.using_mixed_command_line_arguments = Jalview no puede utilizar argumentos de línea de comando antiguos (-arg) y nuevos (--arg). Verifique los argumentos de su línea de comando.\ne.g. {0} y {1}
@Override
public void saveAs_actionPerformed()
{
- String format = currentFileFormat == null ? null
- : currentFileFormat.getName();
- JalviewFileChooser chooser = JalviewFileChooser
- .forWrite(Cache.getProperty("LAST_DIRECTORY"), format, true);
+ JalviewFileChooser chooser = JalviewFileChooser.forWrite(
+ Cache.getProperty("LAST_DIRECTORY"),
+ currentFileFormat == null ? null : currentFileFormat.getName(),
+ true);
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(
{
// if the autodetect format from extension failed..
JvOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.getString(
- "label.select_file_format_before_saving"),
- MessageManager.getString("label.file_format_not_specified"),
- JvOptionPane.WARNING_MESSAGE);
+ MessageManager
+ .getString("label.select_file_format_before_saving"),
+ MessageManager.getString("label.file_format_not_specified"),
+ JvOptionPane.WARNING_MESSAGE);
value = chooser.showSaveDialog(this);
if (value != JalviewFileChooser.APPROVE_OPTION)
{
String lastFilenameSaved;
+ // globalLastFormatSaved across alignment windows (only for alignments with no
+ // previous format)
+ private static FileFormatI globalLastFormatSaved = null;
+
+ public static FileFormatI getLastAlignmentSavedFormat()
+ {
+ return globalLastFormatSaved;
+ }
+
/**
* Raise a dialog or status message for the last call to saveAlignment.
*
lastFilenameSaved = file;
}
lastFormatSaved = format;
+ globalLastFormatSaved = format;
if (FileFormat.Jalview.equals(format))
{
public void run()
{
jalview.bin.Console.debug("Filechooser init thread started.");
- String fileFormat = FileLoader.getUseDefaultFileFormat()
- ? Cache.getProperty("DEFAULT_FILE_FORMAT")
- : null;
+ // default file format now determined by JalviewFileChooser
JalviewFileChooser.forRead(Cache.getProperty("LAST_DIRECTORY"),
- fileFormat);
+ null);
jalview.bin.Console.debug("Filechooser init thread finished.");
}
}).start();
/**
* load all files dropped (2.11.4.0 behaviour)
+ *
* @return false if any file resulted in an error
*/
public boolean loadDroppedFiles(List<Object> files,
"Unexpected Exception when handling " + file.toString(), x);
}
}
- return failed.size()==0; // at least one was loaded.
+ return failed.size() == 0; // at least one was loaded.
}
/**
}
return failed.size() == 0; // redundant for 2.11.4.0 implementation
}
-
+
@Override
public void drop(DropTargetDropEvent evt)
{
@Override
public void inputLocalFileMenuItem_actionPerformed(AlignViewport viewport)
{
- String fileFormat = FileLoader.getUseDefaultFileFormat()
- ? Cache.getProperty("DEFAULT_FILE_FORMAT")
- : null;
+ // default file format now determined by JalviewFileChooser
JalviewFileChooser chooser = JalviewFileChooser.forRead(
- Cache.getProperty("LAST_DIRECTORY"), fileFormat,
+ Cache.getProperty("LAST_DIRECTORY"), null,
BackupFiles.getEnabled());
chooser.setFileView(new JalviewFileView());
}
/**
- * Progress bars managed by the IProgressIndicator method.
- * TODO - delegate to jalview.gui.ProgressBar
+ * Progress bars managed by the IProgressIndicator method. TODO - delegate to
+ * jalview.gui.ProgressBar
*/
private Hashtable<Long, JPanel> progressBars;
private Hashtable<Long, IProgressIndicatorHandler> progressBarHandlers;
-
+
private Hashtable<Long, String> progressBarMessages;
/*
else
{
progressBars.put(Long.valueOf(id), addProgressPanel(message));
- if (message!=null) {
+ if (message != null)
+ {
progressBarMessages.put(id, message);
- } else {
+ }
+ else
+ {
progressBarMessages.remove(id);
}
}
}
}
-
@Override
public String getMessage(long id)
{
return progressBarMessages.get(id);
}
-
+
/**
* change the text shown alongside a progress bar
+ *
* @param id
* @param message
*/
@Override
- public void setProgressBarMessage(long id,String message)
+ public void setProgressBarMessage(long id, String message)
{
Container progBar = progressBars.get(id);
if (progBar == null || progBar.getComponentCount() == 0)
{
if (component.getClass().equals(JLabel.class))
{
- ((JLabel) component).setText(message);;
+ ((JLabel) component).setText(message);
+ ;
progBar.revalidate();
}
}
}
-
+
/**
*
* @return true if any progress bars are still active
Cache.disableSessionProperties();
// TODO: JAL-3048 not needed for Jalview-JS
- String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
+ // default file format now determined by JalviewFileChooser
JalviewFileChooser chooser = JalviewFileChooser
- .forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat);
+ .forRead(Cache.getProperty("LAST_DIRECTORY"), null);
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(
MessageManager.getString("label.select_startup_file"));
import javax.swing.plaf.basic.BasicFileChooserUI;
import jalview.bin.Cache;
+import jalview.gui.AlignFrame;
import jalview.gui.JvOptionPane;
import jalview.util.ChannelProperties;
import jalview.util.MessageManager;
protected boolean includeBackupFiles = false;
/**
+ * default file format preference settings
+ */
+ public final static String DEFAULT_FORMAT_PROPERTY = "DEFAULT_FILE_FORMAT";
+
+ public final static String DEFAULT_SAVE_FORMAT_PROPERTY = "DEFAULT_SAVE_FILE_FORMAT";
+
+ public final static String USE_LAST_SAVED_FORMAT_VALUE = "USE_LAST_SAVED";
+
+ // normally an alignment will default to saving as the format it was loaded or
+ // most recently saved as. Setting this will ignore that and use the
+ // preference default save format.
+ public final static String ALWAYS_USE_DEFAULT_SAVED_FORMAT_PROPERTY = "ALWAYS_USE_DEFAULT_SAVE_FORMAT";
+
+ /**
* Factory method to return a file chooser that offers readable alignment file
* formats
*
}
}
+ if (selected == null)
+ {
+ selected = defaultLoadFileFormat();
+ }
+
return new JalviewFileChooser(directory,
extensions.toArray(new String[extensions.size()]),
descs.toArray(new String[descs.size()]), selected, true,
* @return
*/
public static JalviewFileChooser forWrite(String directory,
- String selected)
- {
- return forWrite(directory, selected, false);
- }
-
- public static JalviewFileChooser forWrite(String directory,
String selected, boolean addSelectFormatFromFileExtension)
{
// TODO in Java 8, forRead and forWrite can be a single method
descs.add(format.getName());
}
}
+
return new JalviewFileChooser(directory,
extensions.toArray(new String[extensions.size()]),
- descs.toArray(new String[descs.size()]), selected, false, false,
+ descs.toArray(new String[descs.size()]),
+ defaultSaveFileFormat(selected), false, false,
addSelectFormatFromFileExtension);
}
MessageManager.getString("label.by_extension_tooltip"));
JalviewFileFilter jvf = (JalviewFileFilter) dd.getSelectedItem();
Iterator<String> extensions = jvf.getExtensions();
- if (extensions.hasNext())
+ if (extensions.hasNext()) // hasAny()
{
- sb.append(" (.");
+ sb.append("\n(.");
while (extensions.hasNext())
{
sb.append(extensions.next());
return dialog;
}
-}
+ /**
+ * return a default file format
+ */
+ public static String defaultLoadFileFormat()
+ {
+ return FileLoader.getUseDefaultFileFormat()
+ ? Cache.getProperty(DEFAULT_FORMAT_PROPERTY)
+ : null;
+ }
+
+ public static String defaultSaveFileFormat(String lastUsedFormat)
+ {
+ if (!Cache.getDefault(ALWAYS_USE_DEFAULT_SAVED_FORMAT_PROPERTY, false)
+ && lastUsedFormat != null)
+ {
+ return lastUsedFormat;
+ }
+
+ String pref = Cache.getDefault(DEFAULT_SAVE_FORMAT_PROPERTY, null);
+ if (USE_LAST_SAVED_FORMAT_VALUE.equals(pref))
+ {
+ FileFormatI globalLastSavedFormat = AlignFrame
+ .getLastAlignmentSavedFormat();
+ if (globalLastSavedFormat != null || lastUsedFormat != null)
+ {
+ return globalLastSavedFormat != null
+ ? globalLastSavedFormat.toString()
+ : lastUsedFormat;
+ }
+ }
+ return pref == null ? FileFormat.Fasta.getName() : pref;
+ }
+
+}
\ No newline at end of file