jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1539539 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/util/FileDialoger.java src/core/org/apache/jmeter/gui/util/FilePanelEntry.java xdocs/changes.xml
Date Thu, 07 Nov 2013 07:45:54 GMT
Author: pmouawad
Date: Thu Nov  7 07:45:53 2013
New Revision: 1539539

URL: http://svn.apache.org/r1539539
Log:
Bug 55753 - Improve FilePanel behaviour to start from the value set in Filename field if any
Bugzilla Id: 55753

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileDialoger.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanelEntry.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileDialoger.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileDialoger.java?rev=1539539&r1=1539538&r2=1539539&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileDialoger.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/FileDialoger.java Thu Nov  7 07:45:53
2013
@@ -23,6 +23,7 @@ import java.io.File;
 import javax.swing.JFileChooser;
 import javax.swing.filechooser.FileFilter;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jmeter.gui.GuiPackage;
 import org.apache.jmeter.gui.JMeterFileFilter;
 
@@ -43,6 +44,15 @@ public final class FileDialoger {
     private FileDialoger() {
     }
 
+
+    public static JFileChooser promptToOpenFile() {
+        return promptToOpenFile((String)null);
+    }
+
+    public static JFileChooser promptToOpenFile(String existingFileName) {
+        return promptToOpenFile(new String[0], existingFileName);
+    }
+    
     /**
      * Prompts the user to choose a file from their filesystems for our own
      * devious uses. This method maintains the last directory the user visited
@@ -55,9 +65,27 @@ public final class FileDialoger {
      *         finished using it - null if no file was chosen
      */
     public static JFileChooser promptToOpenFile(String[] exts) {
+        return promptToOpenFile(exts, null);
+    }
+    
+    /**
+     * Prompts the user to choose a file from their filesystems for our own
+     * devious uses. This method maintains the last directory the user visited
+     * before dismissing the dialog. This does NOT imply they actually chose a
+     * file from that directory, only that they closed the dialog there. It is
+     * the caller's responsibility to check to see if the selected file is
+     * non-null.
+     *
+     * @return the JFileChooser that interacted with the user, after they are
+     *         finished using it - null if no file was chosen
+     */
+    public static JFileChooser promptToOpenFile(String[] exts, String existingFileName) {
         // JFileChooser jfc = null;
-
-        if (lastJFCDirectory == null) {
+        File existingFileStart = new File(existingFileName);
+        if(!StringUtils.isEmpty(existingFileName) && existingFileStart.exists() &&
existingFileStart.canRead()) {
+            jfc.setCurrentDirectory(new File(existingFileName));
+        }
+        else if (lastJFCDirectory == null) {
             String start = System.getProperty("user.dir", ""); //$NON-NLS-1$//$NON-NLS-2$
 
             if (start.length() > 0) {
@@ -87,10 +115,6 @@ public final class FileDialoger {
         }
     }
 
-    public static JFileChooser promptToOpenFile() {
-        return promptToOpenFile(new String[0]);
-    }
-
     /**
      * Prompts the user to choose a file from their filesystems for our own
      * devious uses. This method maintains the last directory the user visited

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanelEntry.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanelEntry.java?rev=1539539&r1=1539538&r2=1539539&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanelEntry.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/FilePanelEntry.java Thu Nov  7 07:45:53
2013
@@ -136,9 +136,9 @@ public class FilePanelEntry extends Hori
         if (e.getActionCommand().equals(ACTION_BROWSE)) {
             JFileChooser chooser;
             if(filetypes == null || filetypes.length == 0){
-                chooser = FileDialoger.promptToOpenFile();
+                chooser = FileDialoger.promptToOpenFile(filename.getText());
             } else {
-                chooser = FileDialoger.promptToOpenFile(filetypes);
+                chooser = FileDialoger.promptToOpenFile(filetypes, filename.getText());
             }
             if (chooser != null && chooser.getSelectedFile() != null) {
                 filename.setText(chooser.getSelectedFile().getPath());

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1539539&r1=1539538&r2=1539539&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Thu Nov  7 07:45:53 2013
@@ -161,6 +161,7 @@ A workaround is to use a Java 7 update 4
 <h3>General</h3>
 <ul>
 <li><bugzilla>55739</bugzilla> - Remote Test : Total threads in GUI mode
shows invalid total number of threads</li>
+<li><bugzilla>55753</bugzilla> - Improve FilePanel behaviour to start from
the value set in Filename field if any</li>
 </ul>
 
 <!-- =================== Improvements =================== -->



Mime
View raw message