Changeset 8177 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2015-04-09T19:53:45+02:00 (9 years ago)
Author:
stoecker
Message:

fix warning

Location:
trunk/src/org/openstreetmap/josm/gui/io
Files:
2 edited

Legend:

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

    r7995 r8177  
    8383        hcbUploadSource.setToolTipText(tr("Enter a source"));
    8484        hcbUploadSource.setMaxTextLength(Changeset.MAX_CHANGESET_TAG_LENGTH);
    85         List<String> sourceHistory = new LinkedList<>(Main.pref.getCollection(SOURCE_HISTORY_KEY,
    86                 Arrays.asList("knowledge", "survey", "Bing")));
     85        List<String> sourceHistory = new LinkedList<>(Main.pref.getCollection(SOURCE_HISTORY_KEY, getDefaultSources()));
    8786        Collections.reverse(sourceHistory); // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement()
    8887        hcbUploadSource.setPossibleItems(sourceHistory);
     
    9291        pnl.add(hcbUploadSource, GBC.eol().fill(GBC.HORIZONTAL));
    9392        return pnl;
     93    }
     94
     95    static public List<String> getDefaultSources() {
     96        return Arrays.asList("knowledge", "survey", "Bing");
    9497    }
    9598
  • trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java

    r8126 r8177  
    570570    }
    571571
    572     private String getLastChangesetTagFromHistory(String historyKey) {
    573         Collection<String> history = Main.pref.getCollection(historyKey, new ArrayList<String>());
     572    private String getLastChangesetTagFromHistory(String historyKey, List<String> def) {
     573        Collection<String> history = Main.pref.getCollection(historyKey, def);
    574574        int age = (int) (System.currentTimeMillis() / 1000 - Main.pref.getInteger(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0));
    575575        if (age < Main.pref.getInteger(BasicUploadSettingsPanel.HISTORY_MAX_AGE_KEY, 4 * 3600 * 1000) && history != null && !history.isEmpty()) {
     
    581581
    582582    public String getLastChangesetCommentFromHistory() {
    583         return getLastChangesetTagFromHistory(BasicUploadSettingsPanel.HISTORY_KEY);
     583        return getLastChangesetTagFromHistory(BasicUploadSettingsPanel.HISTORY_KEY, new ArrayList<String>());
    584584    }
    585585
    586586    public String getLastChangesetSourceFromHistory() {
    587         return getLastChangesetTagFromHistory(BasicUploadSettingsPanel.SOURCE_HISTORY_KEY);
     587        return getLastChangesetTagFromHistory(BasicUploadSettingsPanel.SOURCE_HISTORY_KEY, BasicUploadSettingsPanel.getDefaultSources());
    588588    }
    589589}
Note: See TracChangeset for help on using the changeset viewer.