/** Adds a path to the list of recent files. */ public void add(final String path) { final boolean present = recentModules.containsKey(path); if (present) { // remove(path); // updateInfo(path); } else { recentModules.put(path, createInfo(path)); recentFiles.add(path); Prefs.putList(recentFiles, RECENT_FILES_KEY); } }
public RecentFileService( final ImageJ context, final EventService eventService, final MenuService menuService, final ModuleService moduleService) { super(context); this.eventService = eventService; this.menuService = menuService; this.moduleService = moduleService; // recentFiles = new ArrayList<String>(); recentFiles = Prefs.getList(RECENT_FILES_KEY); recentModules = new HashMap<String, ModuleInfo>(); for (String path : recentFiles) { recentModules.put(path, createInfo(path)); } subscribeToEvents(eventService); }
/** Clears the list of recent files. */ public void clear() { recentFiles.clear(); Prefs.clear(RECENT_FILES_KEY); moduleService.removeModules(recentModules.values()); recentModules.clear(); }
@Override public void run() { if (clearAll) Prefs.clearAll(); }