Skip to content

Commit 212d827

Browse files
committed
RecentFileService: index recent files properly
When invoking the PrefService, we should give a class, not leave it undefined. Otherwise, the recent files list gets stored under the global preferences node, rather than the RecentFileService.
1 parent 4b37eed commit 212d827

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/scijava/io/DefaultRecentFileService.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public boolean remove(final String path) {
147147
@Override
148148
public void clear() {
149149
recentFiles.clear();
150-
prefService.clear(RECENT_FILES_KEY);
150+
prefService.clear(RecentFileService.class, RECENT_FILES_KEY);
151151

152152
// unregister the modules with the module service
153153
moduleService.removeModules(recentModules.values());
@@ -185,12 +185,13 @@ protected void onEvent(final IOEvent event) {
185185

186186
/** Loads the list of recent files from persistent storage. */
187187
private void loadList() {
188-
recentFiles = prefService.getList(RECENT_FILES_KEY);
188+
recentFiles = prefService.getList(RecentFileService.class,
189+
RECENT_FILES_KEY);
189190
}
190191

191192
/** Saves the list of recent files to persistent storage. */
192193
private void saveList() {
193-
prefService.putList(recentFiles, RECENT_FILES_KEY);
194+
prefService.putList(RecentFileService.class, recentFiles, RECENT_FILES_KEY);
194195
}
195196

196197
/** Creates a {@link ModuleInfo} to reopen data at the given path. */

0 commit comments

Comments
 (0)