From 85a10a2e77527a6c763fd52e3175c8158785cbca Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 2 Jul 2018 17:36:28 +0100 Subject: [PATCH] JAL-3048 File->VCF load refactored --- src/jalview/gui/AlignFrame.java | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index e45dc5d..e4a3f8c 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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); } -- 1.7.10.2