From bf448d3b8794da07525adedec9f1ff04428e84cb Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 10 Jul 2018 12:53:51 +0100 Subject: [PATCH] JAL-3048 switch from 'dialogdata' to DialogRunner for load Features/Annotations/Otherdata (also needed File object passed through directly) --- src/jalview/gui/AlignFrame.java | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 507896e..95f1ed1 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1464,39 +1464,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void associatedData_actionPerformed(ActionEvent e) { - JalviewFileChooser chooser = new JalviewFileChooser( + final JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle( MessageManager.getString("label.load_jalview_annotations")); chooser.setToolTipText( MessageManager.getString("label.load_jalview_annotations")); - - Desktop.getDesktop().dialogData = new Object[] { "SelectedFile", - new Runnable() + chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION) { @Override public void run() { - Object[] data = Desktop.getDesktop().dialogData; - int value = ((Integer) data[0]).intValue(); - - if (value == JFileChooser.APPROVE_OPTION) - { - JalviewFileChooser chooser = (JalviewFileChooser) data[2]; - String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); - loadJalviewDataFile(choice, null, null, null); - } + String choice = chooser.getSelectedFile().getPath(); + jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); + loadJalviewDataFile(chooser.getSelectedFile(), null, null, null); } - }, chooser }; - - chooser.showOpenDialog(null); - - + }); + chooser.openDialog(this); } /** -- 1.7.10.2