From: Jim Procter Date: Tue, 10 Jul 2018 11:53:51 +0000 (+0100) Subject: JAL-3048 switch from 'dialogdata' to DialogRunner for load Features/Annotations/Other... X-Git-Tag: Release_2_11_4_0~45^2~18^2~553 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bf448d3b8794da07525adedec9f1ff04428e84cb;p=jalview.git JAL-3048 switch from 'dialogdata' to DialogRunner for load Features/Annotations/Otherdata (also needed File object passed through directly) --- 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); } /**