Ignore:
Timestamp:
2016-12-08T00:54:43+01:00 (7 years ago)
Author:
Don-vip
Message:

findbugs - SIC_INNER_SHOULD_BE_STATIC_ANON

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/RecentlyOpenedFilesMenu.java

    r10428 r11366  
    6060
    6161        for (final String file : fileHistory) {
    62             add(new AbstractAction() {
    63                 {
    64                     putValue(NAME, file);
    65                     putValue("help", ht("/Action/OpenRecent"));
    66                     putValue("toolbar", Boolean.FALSE);
    67                 }
    68                 @Override
    69                 public void actionPerformed(ActionEvent e) {
    70                     File f = new File(file);
    71                     OpenFileTask task = new OpenFileTask(Collections.singletonList(f), null);
    72                     task.setRecordHistory(true);
    73                     Main.worker.submit(task);
    74                 }
    75             });
     62            add(new OpenRecentAction(file));
    7663        }
    7764        add(new JSeparator());
     
    8269        clearItem.setEnabled(!fileHistory.isEmpty());
    8370        add(clearItem);
     71    }
     72
     73    static final class OpenRecentAction extends AbstractAction {
     74        private final String file;
     75
     76        OpenRecentAction(String file) {
     77            this.file = file;
     78            putValue(NAME, file);
     79            putValue("help", ht("/Action/OpenRecent"));
     80            putValue("toolbar", Boolean.FALSE);
     81        }
     82
     83        @Override
     84        public void actionPerformed(ActionEvent e) {
     85            OpenFileTask task = new OpenFileTask(Collections.singletonList(new File(file)), null);
     86            task.setRecordHistory(true);
     87            Main.worker.submit(task);
     88        }
    8489    }
    8590
Note: See TracChangeset for help on using the changeset viewer.