Exemple #1
0
 /** 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);
   }
 }
Exemple #2
0
  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);
  }
Exemple #3
0
 /** Clears the list of recent files. */
 public void clear() {
   recentFiles.clear();
   Prefs.clear(RECENT_FILES_KEY);
   moduleService.removeModules(recentModules.values());
   recentModules.clear();
 }
Exemple #4
0
 @Override
 public void run() {
   if (clearAll) Prefs.clearAll();
 }