khammond    01/09/30 20:41:18

  Modified:    src/org/apache/jmeter/gui FileDialoger.java
  Log:
  Now uses the new JMeterFileFilter to show only *.jmx files by default. User can 
still choose *.* All Files from the menu.
  
  Revision  Changes    Path
  1.5       +18 -10    jakarta-jmeter/src/org/apache/jmeter/gui/FileDialoger.java
  
  Index: FileDialoger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/gui/FileDialoger.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileDialoger.java 2001/07/26 00:34:44     1.4
  +++ FileDialoger.java 2001/10/01 03:41:18     1.5
  @@ -70,12 +70,14 @@
   
   public class FileDialoger
   {
  +     /** The last directory visited by the user while choosing Files. */
  +     public static String lastJFCDirectory = null;
   
        public FileDialoger()
        {
        }
   
  -             /**
  +     /**
         * 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
  @@ -87,21 +89,26 @@
         */
        public static JFileChooser promptToOpenFile() {
                JFileChooser jfc = null;
  -             if( lastJFCDirectory == null ) {
  +
  +             if (lastJFCDirectory == null) {
                        String start = JMeterUtils.getPropDefault("user.dir","");
  -             if(!start.equals(""))
  -               jfc = new JFileChooser(start);
  -             else
  -                       jfc = new JFileChooser();
  +
  +                     if (!start.equals("")) {
  +                             jfc = new JFileChooser(start);
  +                     } else {
  +                             jfc = new JFileChooser();
  +                     }
                } else {
                        jfc = new JFileChooser(lastJFCDirectory);
                }
  +
  +             jfc.addChoosableFileFilter(new JMeterFileFilter());
                jfc.showOpenDialog(GuiPackage.getInstance().getMainFrame());
                lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
  +
                return jfc;
        }
   
  -
        /**
         * Prompts the user to choose a file from their filesystems for our own
         * devious uses.  This method maintains the last directory the user
  @@ -126,10 +133,11 @@
                }
                if(filename != null)
                        jfc.setSelectedFile(new File(lastJFCDirectory,filename));
  +
  +             jfc.addChoosableFileFilter(new JMeterFileFilter());
  +
                jfc.showSaveDialog(GuiPackage.getInstance().getMainFrame());
                lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
                return jfc;
        }
  -     /** The last directory visited by the user while choosing Files. */
  -     public static String lastJFCDirectory = null;
  -}
  \ No newline at end of file
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to