Ignore:
Timestamp:
2017-07-22T14:25:19+02:00 (7 years ago)
Author:
bastiK
Message:

see #15013, see #14877 - remember projection when session is saved to a .jos/.joz file

File:
1 edited

Legend:

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

    r12485 r12486  
    501501     */
    502502    private ProjectionChoice setupProjectionCombo() {
    503         String pcId = projectionChoice != null ? projectionChoice : PROP_PROJECTION_DEFAULT.get();
     503        String pcId = getCurrentProjectionChoiceId();
    504504        ProjectionChoice pc = null;
    505505        for (int i = 0; i < projectionCombo.getItemCount(); ++i) {
    506506            ProjectionChoice pc1 = projectionCombo.getItemAt(i);
    507             pc1.setPreferences(getSubprojectionPreference(pc1));
     507            pc1.setPreferences(getSubprojectionPreference(pc1.getId()));
    508508            if (pc1.getId().equals(pcId)) {
    509509                projectionCombo.setSelectedIndex(i);
     
    524524    }
    525525
    526     private static Collection<String> getSubprojectionPreference(ProjectionChoice pc) {
    527         return Main.pref.getCollection("projection.sub."+pc.getId(), null);
     526    /**
     527     * Get the id of the projection choice that is currently set.
     528     * @return id of the projection choice that is currently set
     529     */
     530    public static String getCurrentProjectionChoiceId() {
     531        return projectionChoice != null ? projectionChoice : PROP_PROJECTION_DEFAULT.get();
     532    }
     533
     534    /**
     535     * Get the preferences that have been selected the last time for the given
     536     * projection choice.
     537     * @param pcId id of the projection choice
     538     * @return projection choice parameters that have been selected by the user
     539     * the last time; null if user has never selected the given projection choice
     540     */
     541    public static Collection<String> getSubprojectionPreference(String pcId) {
     542        return Main.pref.getCollection("projection.sub."+pcId, null);
    528543    }
    529544
Note: See TracChangeset for help on using the changeset viewer.