X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=954bb34bd63bc94e4eedfc845a59a073c7a0500a;hb=567c2595554096f10feab130153f97286f3f7d80;hp=bcb4e7b50fcb9b017fa5a17f4cc75d94f08d917d;hpb=e60cacff9260c47c12cf34a7e191678cfc97d265;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index bcb4e7b..954bb34 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -29,15 +29,17 @@ import jalview.gui.Desktop; import jalview.gui.PromptUserConfig; import jalview.io.AppletFormatAdapter; import jalview.io.BioJsHTMLOutput; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; +import jalview.io.FileFormatException; +import jalview.io.FileFormatI; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import jalview.io.HtmlSvgOutput; import jalview.io.IdentifyFile; import jalview.io.NewickFile; import jalview.io.gff.SequenceOntologyFactory; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; -import jalview.schemes.UserColourScheme; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; @@ -356,7 +358,9 @@ public class Jalview BioJsHTMLOutput.updateBioJS(); } - String file = null, protocol = null, format = null, data = null; + String file = null, data = null; + FileFormatI format = null; + DataSourceType protocol = null; FileLoader fileLoader = new FileLoader(!headless); Vector getFeatures = null; // vector of das source nicknames to // fetch @@ -389,13 +393,13 @@ public class Jalview { try { - String viprotocol = AppletFormatAdapter + DataSourceType viprotocol = AppletFormatAdapter .checkProtocol(vamsasImport); - if (viprotocol == jalview.io.FormatAdapter.FILE) + if (viprotocol == DataSourceType.FILE) { inSession = desktop.vamsasImport(new File(vamsasImport)); } - else if (viprotocol == FormatAdapter.URL) + else if (viprotocol == DataSourceType.URL) { inSession = desktop.vamsasImport(new URL(vamsasImport)); } @@ -484,7 +488,13 @@ public class Jalview protocol = AppletFormatAdapter.checkProtocol(file); - format = new IdentifyFile().identify(file, protocol); + try + { + format = new IdentifyFile().identify(file, protocol); + } catch (FileFormatException e1) + { + // TODO ? + } AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol, format); @@ -500,16 +510,10 @@ public class Jalview { data.replaceAll("%20", " "); - ColourSchemeI cs = ColourSchemeProperty.getColour(af + ColourSchemeI cs = ColourSchemeProperty.getColourScheme(af .getViewport().getAlignment(), data); - if (cs == null) - { - UserColourScheme ucs = new UserColourScheme("white"); - ucs.parseAppletParameter(data); - cs = ucs; - } - else + if (cs != null) { System.out.println("CMD [-color " + data + "] executed successfully!"); @@ -574,18 +578,14 @@ public class Jalview data = aparser.getValue("tree", true); if (data != null) { - jalview.io.NewickFile fin = null; try { System.out.println("CMD [-tree " + data + "] executed successfully!"); - fin = new NewickFile(data, + NewickFile nf = new NewickFile(data, AppletFormatAdapter.checkProtocol(data)); - if (fin != null) - { - af.getViewport().setCurrentTree( - af.ShowNewickTree(fin, data).getTree()); - } + af.getViewport().setCurrentTree( + af.showNewickTree(nf, data).getTree()); } catch (IOException ex) { System.err.println("Couldn't add tree " + data); @@ -629,17 +629,17 @@ public class Jalview String imageName = "unnamed.png"; while (aparser.getSize() > 1) { - format = aparser.nextValue(); + String outputFormat = aparser.nextValue(); file = aparser.nextValue(); - if (format.equalsIgnoreCase("png")) + if (outputFormat.equalsIgnoreCase("png")) { af.createPNG(new File(file)); imageName = (new File(file)).getName(); System.out.println("Creating PNG image: " + file); continue; } - else if (format.equalsIgnoreCase("svg")) + else if (outputFormat.equalsIgnoreCase("svg")) { File imageFile = new File(file); imageName = imageFile.getName(); @@ -647,7 +647,7 @@ public class Jalview System.out.println("Creating SVG image: " + file); continue; } - else if (format.equalsIgnoreCase("html")) + else if (outputFormat.equalsIgnoreCase("html")) { File imageFile = new File(file); imageName = imageFile.getName(); @@ -657,7 +657,7 @@ public class Jalview System.out.println("Creating HTML image: " + file); continue; } - else if (format.equalsIgnoreCase("biojsmsa")) + else if (outputFormat.equalsIgnoreCase("biojsmsa")) { if (file == null) { @@ -678,13 +678,13 @@ public class Jalview + file); continue; } - else if (format.equalsIgnoreCase("imgMap")) + else if (outputFormat.equalsIgnoreCase("imgMap")) { af.createImageMap(new File(file), imageName); System.out.println("Creating image map: " + file); continue; } - else if (format.equalsIgnoreCase("eps")) + else if (outputFormat.equalsIgnoreCase("eps")) { File outputFile = new File(file); System.out.println("Creating EPS file: " @@ -733,20 +733,26 @@ public class Jalview jalview.bin.Cache.removeProperty("STARTUP_FILE"); } - protocol = "File"; + protocol = DataSourceType.FILE; if (file.indexOf("http:") > -1) { - protocol = "URL"; + protocol = DataSourceType.URL; } if (file.endsWith(".jar")) { - format = "Jalview"; + format = FileFormat.Jalview; } else { - format = new IdentifyFile().identify(file, protocol); + try + { + format = new IdentifyFile().identify(file, protocol); + } catch (FileFormatException e) + { + // TODO what? + } } startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,