File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
plugins/sources/src/org/graalvm/visualvm/sources/options Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 63
63
import org .graalvm .visualvm .sources .SourcesViewer ;
64
64
import org .openide .awt .Mnemonics ;
65
65
import org .openide .util .NbBundle ;
66
+ import org .openide .util .NbPreferences ;
66
67
import org .openide .windows .WindowManager ;
67
68
68
69
/**
87
88
})
88
89
final class SourcesOptionsPanel extends JPanel {
89
90
91
+ private static final String PROP_LAST_SOURCES_DIR = "prop_SourcesOptionsPanel_lastDir" ; // NOI18N
92
+
93
+
90
94
SourcesOptionsPanel () {
91
95
initUI ();
92
96
}
@@ -289,14 +293,24 @@ public String getDescription() {
289
293
// }
290
294
// });
291
295
296
+ String lastDirS = NbPreferences .forModule (SourcesOptionsPanel .class ).get (PROP_LAST_SOURCES_DIR , null );
297
+ File lastDir = lastDirS == null ? null : new File (lastDirS );
298
+ if (lastDir != null && lastDir .isDirectory ()) fileChooser .setCurrentDirectory (lastDir );
299
+
292
300
if (fileChooser .showOpenDialog (WindowManager .getDefault ().getMainWindow ()) == JFileChooser .APPROVE_OPTION ) {
293
301
String first = null ;
294
302
for (File selected : fileChooser .getSelectedFiles ()) {
295
303
String path = selected .getAbsolutePath ();
296
304
if (!rootsListModel .contains (path )) rootsListModel .addElement (path );
297
305
if (first == null ) first = path ;
298
306
}
299
- if (first != null ) rootsList .setSelectedValue (first , true );
307
+ if (first != null ) {
308
+ rootsList .setSelectedValue (first , true );
309
+
310
+ File dir = new File (first ).getParentFile ();
311
+ String dirS = dir .isDirectory () ? dir .getAbsolutePath () : null ;
312
+ if (dirS != null ) NbPreferences .forModule (SourcesOptionsPanel .class ).put (PROP_LAST_SOURCES_DIR , dirS );
313
+ }
300
314
}
301
315
}
302
316
};
You can’t perform that action at this time.
0 commit comments