}
return ff;
}
+
+ public static boolean isHeadlessMode()
+ {
+ String isheadless = System.getProperty("java.awt.headless");
+ if (isheadless != null && isheadless.equalsIgnoreCase("true"))
+ {
+ return true;
+ }
+ return false;
+ }
}
/**
return queued == 0 && running == 0;
}
-};
+}
*/
public void ok_actionPerformed(ActionEvent e)
{
- String format = new IdentifyFile().Identify(getText(), "Paste");
+ String text = getText();
+ if (text.trim().length() < 1)
+ {
+ return;
+ }
+
+ String format = new IdentifyFile().Identify(text, "Paste");
// TODO: identify feature, annotation or tree file and parse appropriately.
AlignmentI al = null;
import jalview.api.ComplexAlignFile;
import jalview.api.FeaturesDisplayedI;
+import jalview.bin.Jalview;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
{
format = new IdentifyFile().Identify(file, protocol);
}
+
+ }
+
+ if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE"))
+ {
+ Desktop.instance.stopLoading();
+ System.err.println("The input file \"" + file
+ + "\" has no data content!");
+ if (!Jalview.isHeadlessMode())
+ {
+ JOptionPane.showMessageDialog(null, "The input file \""
+ + file + "\" has no data content!", "Empty data file",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ return;
}
// TODO: cache any stream datasources as a temporary file (eg. PDBs
// retrieved via URL)
}
while ((data = source.nextLine()) != null)
{
- length += data.length();
+ length += data.trim().length();
if (!lineswereskipped)
{
for (int i = 0; !isBinary && i < data.length(); i++)