JAL-3048 TODOs for refactoring JalviewFileChooser pattern
authorJim Procter <jprocter@issues.jalview.org>
Thu, 28 Jun 2018 15:52:56 +0000 (16:52 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 28 Jun 2018 15:52:56 +0000 (16:52 +0100)
JAL-3026 disable browser select dialog for default browser in javasript

src/jalview/gui/Preferences.java

index 7d02fac..019b29e 100755 (executable)
@@ -833,6 +833,7 @@ public class Preferences extends GPreferences
   @Override
   public void startupFileTextfield_mouseClicked()
   {
+    // TODO: JAL-3048 not needed for Jalview-JS
     String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
     JalviewFileChooser chooser = JalviewFileChooser
             .forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat);
@@ -1006,17 +1007,22 @@ public class Preferences extends GPreferences
   @Override
   public void defaultBrowser_mouseClicked(MouseEvent e)
   {
-    JFileChooser chooser = new JFileChooser(".");
-    chooser.setDialogTitle(
-            MessageManager.getString("label.select_default_browser"));
+    // TODO: JAL-3048 not needed for j2s
+    /*
+     * @j2sNative
+     */
+    {
+      JFileChooser chooser = new JFileChooser(".");
+      chooser.setDialogTitle(
+              MessageManager.getString("label.select_default_browser"));
 
-    int value = chooser.showOpenDialog(this);
+      int value = chooser.showOpenDialog(this);
 
-    if (value == JFileChooser.APPROVE_OPTION)
-    {
-      defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath());
+      if (value == JFileChooser.APPROVE_OPTION)
+      {
+        defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath());
+      }
     }
-
   }
 
   /*