JAL-3048 File->VCF load refactored
authorJim Procter <jprocter@issues.jalview.org>
Mon, 2 Jul 2018 16:36:28 +0000 (17:36 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 2 Jul 2018 16:37:40 +0000 (17:37 +0100)
src/jalview/gui/AlignFrame.java

index e45dc5d..e4a3f8c 100644 (file)
@@ -5642,22 +5642,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   @Override
   protected void loadVcf_actionPerformed()
   {
-    // TODO: JAL-3048 - No VCF support in JsJalview
     JalviewFileChooser chooser = new JalviewFileChooser(
             Cache.getProperty("LAST_DIRECTORY"));
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager.getString("label.load_vcf_file"));
     chooser.setToolTipText(MessageManager.getString("label.load_vcf_file"));
+    final AlignFrame us = this;
+    chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
+    {
+      @Override
+      public void run()
+      {
 
-    int value = chooser.showOpenDialog(null);
+        {
+          String choice = chooser.getSelectedFile().getPath();
+          Cache.setProperty("LAST_DIRECTORY", choice);
+          SequenceI[] seqs = viewport.getAlignment().getSequencesArray();
+          new VCFLoader(choice).loadVCF(seqs, us);
+        }
 
-    if (value == JalviewFileChooser.APPROVE_OPTION)
-    {
-      String choice = chooser.getSelectedFile().getPath();
-      Cache.setProperty("LAST_DIRECTORY", choice);
-      SequenceI[] seqs = viewport.getAlignment().getSequencesArray();
-      new VCFLoader(choice).loadVCF(seqs, this);
-    }
+      };
+    }).openDialog(null);
 
   }