Merge branch 'kjvdh/features/PhylogenyViewer_tabbedsupport' into merge/2_11_2/kjvdh...
[jalview.git] / src / jalview / io / BioJsHTMLOutput.java
index 045fc7e..5c19f94 100644 (file)
@@ -20,7 +20,7 @@
  */
 package jalview.io;
 
-import jalview.exceptions.NoFileSelectedException;
+import jalview.bin.Cache;
 import jalview.gui.AlignmentPanel;
 import jalview.gui.OOMWarning;
 import jalview.json.binding.biojs.BioJSReleasePojo;
@@ -41,7 +41,6 @@ import java.util.TreeMap;
 
 public class BioJsHTMLOutput extends HTMLOutput
 {
-
   private static File currentBJSTemplateFile;
 
   private static TreeMap<String, File> bioJsMSAVersions;
@@ -49,43 +48,16 @@ public class BioJsHTMLOutput extends HTMLOutput
   public static final String DEFAULT_DIR = System.getProperty("user.home")
           + File.separatorChar + ".biojs_templates" + File.separatorChar;
 
-  public static final String BJS_TEMPLATES_LOCAL_DIRECTORY = jalview.bin.Cache
+  public static final String BJS_TEMPLATES_LOCAL_DIRECTORY = Cache
           .getDefault("biojs_template_directory", DEFAULT_DIR);
 
-  public static final String BJS_TEMPLATE_GIT_REPO = jalview.bin.Cache
-          .getDefault("biojs_template_git_repo",
-                  "https://raw.githubusercontent.com/jalview/exporter-templates/master/biojs/package.json");
+  public static final String BJS_TEMPLATE_GIT_REPO = Cache.getDefault(
+          "biojs_template_git_repo",
+          "https://raw.githubusercontent.com/jalview/exporter-templates/master/biojs/package.json");
 
   public BioJsHTMLOutput(AlignmentPanel ap)
   {
-    super(ap);
-  }
-
-  @Override
-  public void exportHTML(String outputFile)
-  {
-    exportStarted();
-    try
-    {
-      if (outputFile == null)
-      {
-        outputFile = getOutputFile();
-      }
-      generatedFile = new File(outputFile);
-    } catch (NoFileSelectedException e)
-    {
-      setProgressMessage(MessageManager.formatMessage(
-              "status.cancelled_image_export_operation", "BioJS MSA"));
-      return;
-    } catch (Exception e)
-    {
-      setProgressMessage(MessageManager
-              .formatMessage("info.error_creating_file", "BioJS MSA"));
-      e.printStackTrace();
-      return;
-    }
-    new Thread(this, "ExportBioJsHTMLThread").start();
-
+    super(ap, "BioJS MSA");
   }
 
   public static void refreshVersionInfo(String dirName)
@@ -271,12 +243,6 @@ public class BioJsHTMLOutput extends HTMLOutput
   }
 
   @Override
-  public File getExportedFile()
-  {
-    return generatedFile;
-  }
-
-  @Override
   public void run()
   {
     try
@@ -293,7 +259,7 @@ public class BioJsHTMLOutput extends HTMLOutput
       out.flush();
       out.close();
       setProgressMessage(MessageManager
-              .formatMessage("status.export_complete", "BioJS"));
+              .formatMessage("status.export_complete", getDescription()));
       exportCompleted();
 
     } catch (OutOfMemoryError err)
@@ -304,7 +270,7 @@ public class BioJsHTMLOutput extends HTMLOutput
     } catch (Exception e)
     {
       setProgressMessage(MessageManager
-              .formatMessage("info.error_creating_file", "HTML"));
+              .formatMessage("info.error_creating_file", getDescription()));
       e.printStackTrace();
     }