*/
package jalview.bin;
+import java.awt.GraphicsEnvironment;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.ws.jws2.Jws2Discoverer;
-//import netscape.javascript.JSObject;
/**
* Main class for Jalview Application <br>
// }
public static Jalview getInstance()
{
+ System.out.println("Hello, MW!!!!!!!!!!!!");
return (Jalview) ApplicationSingletonProvider
.getInstance(Jalview.class);
}
showUsage();
System.exit(0);
}
- // ?>>
+ // BH note: Only -nodisplay is official; others are deprecated?
if (aparser.contains("nodisplay") || aparser.contains("nogui")
- || aparser.contains("headless"))
+ || aparser.contains("headless")
+ || GraphicsEnvironment.isHeadless())
+ {
+ if (!isJS) {
+ // BH Definitely not a good idea in JavaScript;
+ // probably should not be here for Java, either.
+ System.setProperty("java.awt.headless", "true");
+ }
+ headless = true;
+ }
+ if (GraphicsEnvironment.isHeadless())
{
- System.setProperty("java.awt.headless", "true");
headless = true;
}
// <<?
}
defs = aparser.getValue("setprop");
}
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
- {
- headless = true;
- }
System.setProperty("http.agent",
"Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
try
* @param aparser
* @param format
*/
- private void createOutputFiles(ArgsParser aparser,
- FileFormatI format)
+ private void createOutputFiles(ArgsParser aparser, FileFormatI format)
{
AlignFrame af = currentAlignFrame;
while (aparser.getSize() >= 2)
System.out.println(
"Creating image map: " + imageFile.getAbsolutePath());
continue;
- }
- if (!Platform.isJS()) /** @j2sIgnore */
- {
- // skipping outputFormat?
- System.out.println("Unknown arg: " + outputFormat);
- fname = new File(aparser.nextValue()).getAbsolutePath();
- af.saveAlignment(fname, format);
- if (af.isSaveAlignmentSuccessful())
+ default:
+ // fall through - try to parse as an alignment data export format
+ FileFormatI outFormat = null;
+ try
+ {
+ outFormat = FileFormats.getInstance().forName(outputFormat);
+ } catch (Exception formatP)
+ {
+ }
+ if (outFormat == null)
+ {
+ System.out.println("Couldn't parse " + outputFormat
+ + " as a valid Jalview format string.");
+ continue;
+ }
+ if (!outFormat.isWritable())
{
System.out.println(
- "Written alignment in " + format + " format to " + fname);
+ "This version of Jalview does not support alignment export as "
+ + outputFormat);
+ continue;
+ }
+ // record file as it was passed to Jalview so it is recognisable to the CLI
+ // caller
+ String file;
+ fname = new File(file = aparser.nextValue()).getAbsolutePath();
+ // JBPNote - yuck - really wish we did have a bean returned from this which gave
+ // success/fail like before !
+ af.saveAlignment(fname, outFormat);
+ if (!af.isSaveAlignmentSuccessful())
+ {
+ System.out.println("Written alignment in " + outputFormat
+ + " format to " + file);
+ continue;
}
else
{
- System.out.println("Error writing file " + fname + " in " + format
- + " format!!");
+ System.out.println("Error writing file " + file + " in "
+ + outputFormat + " format!!");
}
}
- break;
}
+ // ??? Should report - 'ignoring' extra args here...
while (aparser.getSize() > 0)
{
- System.out.println("Unknown arg: " + aparser.nextValue());
+ System.out.println("Ignoring extra argument: " + aparser.nextValue());
}
}