View | Details | Raw Unified | Return to bug 63945
Collapse All | Expand All

(-)a/src/core/src/main/java/org/apache/jmeter/gui/util/FileDialoger.java (-12 / +13 lines)
Lines 180-197 Link Here
180
       } else {
180
       } else {
181
           jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
181
           jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
182
       }
182
       }
183
       if(!StringUtils.isEmpty(existingFileName)) {
183
       if (!StringUtils.isEmpty(existingFileName)) {
184
           File existingFileStart = new File(existingFileName);
184
           setCurrentDirOnJFC(existingFileName);
185
           if(existingFileStart.exists() && existingFileStart.canRead()) {
185
       } else if (lastJFCDirectory == null) {
186
               jfc.setCurrentDirectory(new File(existingFileName));
187
           }
188
       }
189
       else if (lastJFCDirectory == null) {
190
           String start = System.getProperty("user.dir", ""); //$NON-NLS-1$//$NON-NLS-2$
186
           String start = System.getProperty("user.dir", ""); //$NON-NLS-1$//$NON-NLS-2$
191
187
192
           if (start.length() > 0) {
188
           if (start.length() > 0) {
193
               jfc.setCurrentDirectory(new File(start));
189
               setCurrentDirOnJFC(start);
194
           }
190
           }
191
       } else {
192
           setCurrentDirOnJFC(lastJFCDirectory);
195
       }
193
       }
196
       clearFileFilters();
194
       clearFileFilters();
197
       if(exts != null && exts.length > 0) {
195
       if(exts != null && exts.length > 0) {
Lines 200-209 Link Here
200
           jfc.setAcceptAllFileFilterUsed(true);
198
           jfc.setAcceptAllFileFilterUsed(true);
201
           jfc.setFileFilter(currentFilter);
199
           jfc.setFileFilter(currentFilter);
202
       }
200
       }
203
       if(lastJFCDirectory==null) {
204
           lastJFCDirectory = System.getProperty("user.dir", ""); //$NON-NLS-1$//$NON-NLS-2$
205
       }
206
       jfc.setCurrentDirectory(new File(lastJFCDirectory));
207
       int retVal = jfc.showOpenDialog(parentComponent);
201
       int retVal = jfc.showOpenDialog(parentComponent);
208
       lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
202
       lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
209
203
Lines 213-218 Link Here
213
       return null;
207
       return null;
214
   }
208
   }
215
209
210
    private static void setCurrentDirOnJFC(String currentDirName) {
211
        File currentDir = new File(currentDirName);
212
        if (currentDir.exists() && currentDir.canRead()) {
213
            jfc.setCurrentDirectory(currentDir);
214
        }
215
    }
216
216
    private static void clearFileFilters() {
217
    private static void clearFileFilters() {
217
        FileFilter[] filters = jfc.getChoosableFileFilters();
218
        FileFilter[] filters = jfc.getChoosableFileFilters();
218
        for (FileFilter filter : filters) {
219
        for (FileFilter filter : filters) {

Return to bug 63945