From 8b844f70b97629d597be49cb6ac0d83c8da007c9 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 25 Jan 2017 12:15:43 +0000 Subject: [PATCH] JAL-2344 push Cache.getProperty("LAST_DIRECTORY") inside method --- src/jalview/gui/Desktop.java | 8 ++++---- src/jalview/gui/FeatureSettings.java | 6 ++---- src/jalview/gui/TreePanel.java | 2 -- src/jalview/gui/UserDefinedColours.java | 7 ++----- src/jalview/gui/WsParamSetManager.java | 3 +-- src/jalview/io/HTMLOutput.java | 5 ++--- src/jalview/io/JalviewFileChooser.java | 10 ++++------ src/jalview/util/ImageMaker.java | 10 +++------- 8 files changed, 18 insertions(+), 33 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 4ce42dc..0321662 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -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()); diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index bb5f13c..26f9964 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -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 diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 6fa4493..25f4c1b 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -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()); diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 0df23e0..6b4bd10 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -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(); lowerCaseButtons = new ArrayList(); - 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()); diff --git a/src/jalview/gui/WsParamSetManager.java b/src/jalview/gui/WsParamSetManager.java index b260e1b..1aa0803 100644 --- a/src/jalview/gui/WsParamSetManager.java +++ b/src/jalview/gui/WsParamSetManager.java @@ -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 diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index b0ca25b..68f3e2c 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -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 diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index 2a0f8b1..98cd162 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -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, diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java index 8f8af54..fa2533f 100755 --- a/src/jalview/util/ImageMaker.java +++ b/src/jalview/util/ImageMaker.java @@ -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); } } -- 1.7.10.2