JAL-3048 switch from 'dialogdata' to DialogRunner for load Features/Annotations/Other...
authorJim Procter <jprocter@issues.jalview.org>
Tue, 10 Jul 2018 11:53:51 +0000 (12:53 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 10 Jul 2018 11:53:51 +0000 (12:53 +0100)
src/jalview/gui/AlignFrame.java

index 507896e..95f1ed1 100644 (file)
@@ -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);
   }
 
   /**