JAL-2344 push Cache.getProperty("LAST_DIRECTORY") inside method
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 25 Jan 2017 12:15:43 +0000 (12:15 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 25 Jan 2017 12:15:43 +0000 (12:15 +0000)
src/jalview/gui/Desktop.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/TreePanel.java
src/jalview/gui/UserDefinedColours.java
src/jalview/gui/WsParamSetManager.java
src/jalview/io/HTMLOutput.java
src/jalview/io/JalviewFileChooser.java
src/jalview/util/ImageMaker.java

index 4ce42dc..0321662 100644 (file)
@@ -1531,8 +1531,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   @Override
   public void saveState_actionPerformed(ActionEvent e)
   {
-    JalviewFileChooser chooser = new JalviewFileChooser(
-            Cache.getProperty("LAST_DIRECTORY"), "jvp", "Jalview Project");
+    JalviewFileChooser chooser = new JalviewFileChooser("jvp",
+            "Jalview Project");
 
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager.getString("label.save_state"));
@@ -2185,8 +2185,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
     if (v_client != null)
     {
-      JalviewFileChooser chooser = new JalviewFileChooser(
-              Cache.getProperty("LAST_DIRECTORY"), "vdj",// TODO: VAMSAS DOCUMENT EXTENSION is VDJ
+   // TODO: VAMSAS DOCUMENT EXTENSION is VDJ
+      JalviewFileChooser chooser = new JalviewFileChooser("vdj",
               "Vamsas Document");
 
       chooser.setFileView(new JalviewFileView());
index bb5f13c..26f9964 100644 (file)
@@ -748,8 +748,7 @@ public class FeatureSettings extends JPanel implements
 
   void load()
   {
-    JalviewFileChooser chooser = new JalviewFileChooser(
-            Cache.getProperty("LAST_DIRECTORY"), "fc",
+    JalviewFileChooser chooser = new JalviewFileChooser("fc",
             "Sequence Feature Colours");
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager
@@ -841,8 +840,7 @@ public class FeatureSettings extends JPanel implements
 
   void save()
   {
-    JalviewFileChooser chooser = new JalviewFileChooser(
-            Cache.getProperty("LAST_DIRECTORY"), "fc",
+    JalviewFileChooser chooser = new JalviewFileChooser("fc",
             "Sequence Feature Colours");
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager
index 6fa4493..25f4c1b 100755 (executable)
@@ -749,7 +749,6 @@ public class TreePanel extends GTreePanel
     try
     {
       JalviewFileChooser chooser = new JalviewFileChooser(
-              Cache.getProperty("LAST_DIRECTORY"),
               ImageMaker.EPS_EXTENSION, ImageMaker.EPS_EXTENSION);
       chooser.setFileView(new JalviewFileView());
       chooser.setDialogTitle(MessageManager
@@ -796,7 +795,6 @@ public class TreePanel extends GTreePanel
     try
     {
       JalviewFileChooser chooser = new JalviewFileChooser(
-              Cache.getProperty("LAST_DIRECTORY"),
               ImageMaker.PNG_EXTENSION, ImageMaker.PNG_DESCRIPTION);
 
       chooser.setFileView(new jalview.io.JalviewFileView());
index 0df23e0..6b4bd10 100755 (executable)
@@ -21,7 +21,6 @@
 package jalview.gui;
 
 import jalview.api.structures.JalviewStructureDisplayI;
-import jalview.bin.Cache;
 import jalview.datamodel.SequenceGroup;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
@@ -597,8 +596,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
     upperCaseButtons = new ArrayList<JButton>();
     lowerCaseButtons = new ArrayList<JButton>();
 
-    JalviewFileChooser chooser = new JalviewFileChooser(
-            Cache.getProperty("LAST_DIRECTORY"), "jc",
+    JalviewFileChooser chooser = new JalviewFileChooser("jc",
             "Jalview User Colours");
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager
@@ -832,8 +830,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
 
       userColourSchemes.remove(schemeName.getText());
     }
-    JalviewFileChooser chooser = new JalviewFileChooser(
-            Cache.getProperty("LAST_DIRECTORY"), "jc",
+    JalviewFileChooser chooser = new JalviewFileChooser("jc",
             "Jalview User Colours");
 
     chooser.setFileView(new JalviewFileView());
index b260e1b..1aa0803 100644 (file)
@@ -183,8 +183,7 @@ public class WsParamSetManager implements ParamManager
     }
     if (filename == null)
     {
-      JalviewFileChooser chooser = new JalviewFileChooser(
-              Cache.getProperty("LAST_DIRECTORY"), "wsparams",
+      JalviewFileChooser chooser = new JalviewFileChooser("wsparams",
               "Web Service Parameter File");
       chooser.setFileView(new JalviewFileView());
       chooser.setDialogTitle(MessageManager
index b0ca25b..68f3e2c 100755 (executable)
@@ -1,7 +1,6 @@
 package jalview.io;
 
 import jalview.api.AlignExportSettingI;
-import jalview.bin.Cache;
 import jalview.datamodel.AlignmentExportData;
 import jalview.exceptions.NoFileSelectedException;
 import jalview.gui.AlignmentPanel;
@@ -243,8 +242,8 @@ public abstract class HTMLOutput implements Runnable
               pSessionId);
     }
 
-    JalviewFileChooser jvFileChooser = new JalviewFileChooser(
-            Cache.getProperty("LAST_DIRECTORY"), "html", "HTML files");
+    JalviewFileChooser jvFileChooser = new JalviewFileChooser("html",
+            "HTML files");
     jvFileChooser.setFileView(new JalviewFileView());
 
     jvFileChooser.setDialogTitle(MessageManager
index 2a0f8b1..98cd162 100755 (executable)
@@ -21,6 +21,7 @@
 //////////////////////////////////////////////////////////////////
 package jalview.io;
 
+import jalview.bin.Cache;
 import jalview.gui.JvOptionPane;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
@@ -124,16 +125,13 @@ public class JalviewFileChooser extends JFileChooser
   /**
    * Constructor for a single choice of file extension and description
    * 
-   * @param dir
    * @param extension
    * @param desc
    */
-  public JalviewFileChooser(String dir, String extension, String desc)
+  public JalviewFileChooser(String extension, String desc)
   {
-    // TODO inline dir as Cache.getProperty("LAST_DIRECTORY") ? if applet
-    // builds ok
-    this(dir, new String[] { extension }, new String[] { desc }, desc,
-            true);
+    this(Cache.getProperty("LAST_DIRECTORY"), new String[] { extension },
+            new String[] { desc }, desc, true);
   }
 
   JalviewFileChooser(String dir, String[] extensions, String[] descs,
index 8f8af54..fa2533f 100755 (executable)
@@ -20,7 +20,6 @@
  */
 package jalview.util;
 
-import jalview.bin.Cache;
 import jalview.bin.Jalview;
 import jalview.gui.EPSOptions;
 import jalview.gui.IProgressIndicator;
@@ -310,8 +309,7 @@ public class ImageMaker
     {
       return null;
     }
-    return new JalviewFileChooser(Cache.getProperty("LAST_DIRECTORY"),
-            PNG_EXTENSION, PNG_DESCRIPTION);
+    return new JalviewFileChooser(PNG_EXTENSION, PNG_DESCRIPTION);
   }
 
   static JalviewFileChooser getEPSChooser()
@@ -320,8 +318,7 @@ public class ImageMaker
     {
       return null;
     }
-    return new JalviewFileChooser(Cache.getProperty("LAST_DIRECTORY"),
-            EPS_EXTENSION, EPS_DESCRIPTION);
+    return new JalviewFileChooser(EPS_EXTENSION, EPS_DESCRIPTION);
   }
 
   private void setProgressMessage(String message)
@@ -338,7 +335,6 @@ public class ImageMaker
     {
       return null;
     }
-    return new JalviewFileChooser(Cache.getProperty("LAST_DIRECTORY"),
-            SVG_EXTENSION, SVG_DESCRIPTION);
+    return new JalviewFileChooser(SVG_EXTENSION, SVG_DESCRIPTION);
   }
 }