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}
-warning.the_following_errors = The following errors and warnings occurred whilst processing files.
+warning.the_following_errors = The following errors and warnings occurred whilst processing files:
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}
-warning.the_following_errors = Se produjeron los siguientes errores y advertencias al procesar archivos.
-
+warning.the_following_errors = Se produjeron los siguientes errores y advertencias al procesar archivos:
}
// report errors
- Console.debug("All errors from command line argument commands:\n"
- + errorsToString());
+ Console.warn(
+ "The following errors and warnings occurred whilst processing files:\n"
+ + errorsToString());
// gui errors reported in Jalview
if (argParser.getBoolean(Arg.QUIT))
return true;
}
- boolean isError = false;
+ Boolean isError = Boolean.valueOf(false);
// set wrap scope here so it can be applied after structures are opened
boolean wrap = false;
AppJmol jmol = (AppJmol) sview;
try
{
- whatNext wn = this.checksBeforeWritingToFile(avm, subVals,
- false, structureImageFilename, "structure image");
- if (wn == whatNext.ERROR)
- {
- isError = true;
- continue;
- }
- else if (wn == whatNext.CONTINUE)
+ boolean success = this.checksBeforeWritingToFile(avm,
+ subVals, false, structureImageFilename,
+ "structure image", isError);
+ if (!success)
{
continue;
}
return false;
}
- boolean isError = false;
+ Boolean isError = Boolean.valueOf(false);
if (avm.containsArg(Arg.IMAGE))
{
for (ArgValue av : avm.getArgValueList(Arg.IMAGE))
Console.info("Writing " + file);
- whatNext wn = this.checksBeforeWritingToFile(avm, subVal, false,
- fileName, "image");
- if (wn == whatNext.ERROR)
- {
- isError = true;
- continue;
- }
- else if (wn == whatNext.CONTINUE)
+ boolean success = checksBeforeWritingToFile(avm, subVal, false,
+ fileName, "image", isError);
+ if (!success)
{
continue;
}
return false;
}
- boolean isError = false;
+ Boolean isError = Boolean.valueOf(false);
if (avm.containsArg(Arg.OUTPUT))
{
}
}
- whatNext wn = this.checksBeforeWritingToFile(avm, subVals, true,
- fileName, ff.getName());
- if (wn == whatNext.ERROR)
- {
- isError = true;
- continue;
- }
- else if (wn == whatNext.CONTINUE)
+ boolean success = checksBeforeWritingToFile(avm, subVals, true,
+ fileName, ff.getName(), isError);
+ if (!success)
{
continue;
}
errors.add(errorMessage);
}
- private enum whatNext
- {
- OKAY, CONTINUE, ERROR;
- }
-
- private whatNext checksBeforeWritingToFile(ArgValuesMap avm,
+ private boolean checksBeforeWritingToFile(ArgValuesMap avm,
SubVals subVal, boolean includeBackups, String filename,
- String adjective)
+ String adjective, Boolean isError)
{
File file = new File(filename);
+ Arg.OVERWRITE.argString()
+ (includeBackups ? " or " + Arg.BACKUPS.argString() : "")
+ " set");
- return whatNext.CONTINUE;
+ return false;
}
boolean mkdirs = ArgParser.getFromSubValArgOrPref(avm, Arg.MKDIRS,
+ "' does not exist for " + adjective + " file '" + filename
+ "'."
+ (mkdirs ? "" : " Try using " + Arg.MKDIRS.argString()));
- return whatNext.ERROR;
+ isError = true;
+ return false;
}
- return whatNext.OKAY;
+ return true;
}
public List<String> getErrors()
StringBuilder sb = new StringBuilder();
for (String error : errors)
{
+ if (sb.length() > 0)
+ sb.append("\n");
sb.append("- " + error);
- sb.append("\n");
}
return sb.toString();
}
if (oldStyle)
{
String warning = MessageManager
- .getString("warning.using_old_command_line_arguments")
- + "https://www.jalview.org/help/html/features/commandline.html";
+ .getString("warning.using_old_command_line_arguments");
+ String url = "https://www.jalview.org/help/html/features/commandline.html";
if (Desktop.instance != null)
{
String cont = MessageManager.getString("label.continue");
- Desktop.instance.nonBlockingDialog(32, 2, title, warning, cont,
+ Desktop.instance.nonBlockingDialog(32, 2, title, warning, url, cont,
JvOptionPane.WARNING_MESSAGE, false, false);
}
}
String message = MessageManager
.getString("warning.the_following_errors");
String ok = MessageManager.getString("action.ok");
- Desktop.instance.nonBlockingDialog(60, 16, title,
- message + "\n" + j.getCommands().errorsToString(), ok,
+ int shortest = 60;
+ List<String> errors = j.getCommands().getErrors();
+ for (int i = 0; i < errors.size(); i++)
+ {
+ shortest = Math.min(shortest, errors.get(i).length());
+ }
+ Desktop.instance.nonBlockingDialog(
+ Math.max(message.length(), Math.min(60, shortest)),
+ Math.min(errors.size(), 20), title, message,
+ j.getCommands().errorsToString(), ok,
JvOptionPane.WARNING_MESSAGE, true, true);
}
}
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
public void nonBlockingDialog(String title, String message, String button,
int type, boolean scrollable, boolean modal)
{
- nonBlockingDialog(32, 2, title, message, button, type, scrollable,
+ nonBlockingDialog(32, 2, title, message, null, button, type, scrollable,
modal);
}
public void nonBlockingDialog(int width, int height, String title,
- String message, String button, int type, boolean scrollable,
- boolean modal)
+ String message, String boxtext, String button, int type,
+ boolean scrollable, boolean modal)
{
if (type < 0)
{
type = JvOptionPane.WARNING_MESSAGE;
}
+ JLabel jl = new JLabel(message);
+
JTextArea jta = new JTextArea(height, width);
// jta.setLineWrap(true);
jta.setEditable(false);
jta.setWrapStyleWord(true);
jta.setAutoscrolls(true);
- jta.setText(message);
+ jta.setText(boxtext);
JScrollPane jsp = scrollable
? new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
: null;
JvOptionPane jvp = JvOptionPane.newOptionDialog(this);
+
+ JPanel jp = new JPanel();
+ jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
+
+ if (message != null)
+ {
+ jl.setAlignmentX(Component.LEFT_ALIGNMENT);
+ jp.add(jl);
+ }
+ if (boxtext != null)
+ {
+ if (scrollable)
+ {
+ jsp.setAlignmentX(Component.LEFT_ALIGNMENT);
+ jp.add(jsp);
+ }
+ else
+ {
+ jta.setAlignmentX(Component.LEFT_ALIGNMENT);
+ jp.add(jta);
+ }
+ }
+
jvp.setResponseHandler(JOptionPane.YES_OPTION, () -> {
});
- jvp.showDialogOnTopAsync(this, scrollable ? jsp : jta, title,
- JOptionPane.YES_OPTION, type, null, new Object[]
+ jvp.showDialogOnTopAsync(this, jp, title, JOptionPane.YES_OPTION, type,
+ null, new Object[]
{ button }, button, modal, null, false);
}