Ignore:
Timestamp:
2012-01-26T21:52:34+01:00 (12 years ago)
Author:
jttt
Message:

Use static class were appropriate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java

    r4839 r4874  
    3232
    3333    public static final boolean registerSourceProvider(SourceProvider provider) {
    34         if (provider != null) {
     34        if (provider != null)
    3535            return styleSourceProviders.add(provider);
    36         }
    3736        return false;
    3837    }
    39    
     38
    4039    public static class Factory implements PreferenceSettingFactory {
    4140        public PreferenceSetting createPreferenceSetting() {
     
    6968                    }
    7069                }
    71         );
    72     }
    73 
    74     class MapPaintSourceEditor extends SourceEditor {
     70                );
     71    }
     72
     73    static class MapPaintSourceEditor extends SourceEditor {
    7574
    7675        final private String iconpref = "mappaint.icon.sources";
     
    118117        public String getStr(I18nString ident) {
    119118            switch (ident) {
    120                 case AVAILABLE_SOURCES:
    121                     return tr("Available styles:");
    122                 case ACTIVE_SOURCES:
    123                     return tr("Active styles:");
    124                 case NEW_SOURCE_ENTRY_TOOLTIP:
    125                      return tr("Add a new style by entering filename or URL");
    126                 case NEW_SOURCE_ENTRY:
    127                     return tr("New style entry:");
    128                 case REMOVE_SOURCE_TOOLTIP:
    129                     return tr("Remove the selected styles from the list of active styles");
    130                 case EDIT_SOURCE_TOOLTIP:
    131                     return tr("Edit the filename or URL for the selected active style");
    132                 case ACTIVATE_TOOLTIP:
    133                     return tr("Add the selected available styles to the list of active styles");
    134                 case RELOAD_ALL_AVAILABLE:
    135                     return marktr("Reloads the list of available styles from ''{0}''");
    136                 case LOADING_SOURCES_FROM:
    137                     return marktr("Loading style sources from ''{0}''");
    138                 case FAILED_TO_LOAD_SOURCES_FROM:
    139                     return marktr("<html>Failed to load the list of style sources from<br>"
    140                             + "''{0}''.<br>"
    141                             + "<br>"
    142                             + "Details (untranslated):<br>{1}</html>");
    143                 case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:
    144                     return "/Preferences/Styles#FailedToLoadStyleSources";
    145                 case ILLEGAL_FORMAT_OF_ENTRY:
    146                     return marktr("Warning: illegal format of entry in style list ''{0}''. Got ''{1}''");
    147                 default: throw new AssertionError();
     119            case AVAILABLE_SOURCES:
     120                return tr("Available styles:");
     121            case ACTIVE_SOURCES:
     122                return tr("Active styles:");
     123            case NEW_SOURCE_ENTRY_TOOLTIP:
     124                return tr("Add a new style by entering filename or URL");
     125            case NEW_SOURCE_ENTRY:
     126                return tr("New style entry:");
     127            case REMOVE_SOURCE_TOOLTIP:
     128                return tr("Remove the selected styles from the list of active styles");
     129            case EDIT_SOURCE_TOOLTIP:
     130                return tr("Edit the filename or URL for the selected active style");
     131            case ACTIVATE_TOOLTIP:
     132                return tr("Add the selected available styles to the list of active styles");
     133            case RELOAD_ALL_AVAILABLE:
     134                return marktr("Reloads the list of available styles from ''{0}''");
     135            case LOADING_SOURCES_FROM:
     136                return marktr("Loading style sources from ''{0}''");
     137            case FAILED_TO_LOAD_SOURCES_FROM:
     138                return marktr("<html>Failed to load the list of style sources from<br>"
     139                        + "''{0}''.<br>"
     140                        + "<br>"
     141                        + "Details (untranslated):<br>{1}</html>");
     142            case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:
     143                return "/Preferences/Styles#FailedToLoadStyleSources";
     144            case ILLEGAL_FORMAT_OF_ENTRY:
     145                return marktr("Warning: illegal format of entry in style list ''{0}''. Got ''{1}''");
     146            default: throw new AssertionError();
    148147            }
    149148        }
     
    177176        public MapPaintPrefMigration() {
    178177            super("mappaint.style.sources",
    179                   "mappaint.style.enable-defaults",
    180                   "mappaint.style.sources-list");
     178                    "mappaint.style.enable-defaults",
     179                    "mappaint.style.sources-list");
    181180        }
    182181
     
    215214        private boolean insertNewDefaults(List<SourceEntry> list) {
    216215            boolean changed = false;
    217            
     216
    218217            Collection<String> knownDefaults = new TreeSet<String>(Main.pref.getCollection("mappaint.style.known-defaults"));
    219218
     
    223222                int i = Utils.indexOf(list,
    224223                        new Predicate<SourceEntry>() {
    225                             @Override
    226                             public boolean evaluate(SourceEntry se) {
    227                                 return Utils.equal(def.url, se.url);
    228                             }
    229                         });
     224                    @Override
     225                    public boolean evaluate(SourceEntry se) {
     226                        return Utils.equal(def.url, se.url);
     227                    }
     228                });
    230229                if (i == -1 && !knownDefaults.contains(def.url)) {
    231230                    list.add(insertionIdx, def);
     
    268267                    entry.url,
    269268                    entry.name == null ? "" : entry.name,
    270                     entry.title == null ? "" : entry.title,
    271                     Boolean.toString(entry.active)
     269                            entry.title == null ? "" : entry.title,
     270                                    Boolean.toString(entry.active)
    272271            });
    273272        }
Note: See TracChangeset for help on using the changeset viewer.