Ignore:
Timestamp:
2009-07-08T16:40:06+02:00 (15 years ago)
Author:
stoecker
Message:

fix for 1742

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePreference.java

    r13497 r16383  
    4040    private List<String>colorKeys;
    4141    private ColorPreference colorPreference;
    42    
     42
    4343    /**
    44      * Default Constructor 
     44     * Default Constructor
    4545     */
    4646    public ColorSchemePreference() {
    4747    }
    48    
     48
    4949
    5050    /* (non-Javadoc)
     
    5858        schemesList = new JList(listModel);
    5959        String schemes = Main.pref.get(PREF_KEY_SCHEMES_NAMES);
    60         StringTokenizer st = new StringTokenizer(schemes, ";");       
     60        StringTokenizer st = new StringTokenizer(schemes, ";");
    6161        String schemeName;
    6262        while (st.hasMoreTokens()) {
     
    7272                else {
    7373                    String schemeName = (String) listModel.get(schemesList.getSelectedIndex());
    74                     getColorPreference().setColorModel(getColorMap(schemeName));
     74                    getColorPreference(gui).setColorModel(getColorMap(schemeName));
    7575                }
    7676            }
     
    8383                    return;
    8484                schemeName = schemeName.replaceAll("\\.", "_");
    85                 setColorScheme(schemeName, getColorPreference().getColorModel());
     85                setColorScheme(schemeName, getColorPreference(gui).getColorModel());
    8686                listModel.addElement(schemeName);
    8787                saveSchemeNamesToPref();
     
    118118        buttonPanel.add(deleteScheme, GBC.std().insets(0,5,5,0));
    119119    }
    120    
     120
    121121    /**
    122      * Saves the names of the schemes to the preferences. 
     122     * Saves the names of the schemes to the preferences.
    123123     */
    124124    public void saveSchemeNamesToPref() {
     
    129129            Main.pref.put(PREF_KEY_SCHEMES_NAMES, sb.toString().substring(1));
    130130        } else
    131             Main.pref.put(PREF_KEY_SCHEMES_NAMES, null);       
     131            Main.pref.put(PREF_KEY_SCHEMES_NAMES, null);
    132132    }
    133133
     
    135135        return false;// nothing to do
    136136    }
    137    
     137
    138138    /**
    139139     * Remove all color entries for the given scheme from the preferences.
     
    145145        for(String key : colors.keySet()) {
    146146            Main.pref.put(key, null);
    147         }       
     147        }
    148148    }
    149    
     149
    150150    /**
    151151     * Copy all color entries from the given map to entries in preferences with the scheme name.
     
    160160        }
    161161    }
    162    
     162
    163163    /**
    164      * Reads all colors for a scheme and returns them in a map (key = color key without prefix, 
     164     * Reads all colors for a scheme and returns them in a map (key = color key without prefix,
    165165     * value = html color code).
    166166     * @param schemeName the name of the scheme.
     
    177177    }
    178178
    179     public ColorPreference getColorPreference() {
     179    public ColorPreference getColorPreference(PreferenceDialog gui) {
    180180        if(colorPreference == null) {
    181             for(PreferenceSetting setting : PreferenceDialog.settings) {
     181            for(PreferenceSetting setting : gui.getSettings()) {
    182182                if(setting instanceof ColorPreference) {
    183183                    colorPreference = (ColorPreference) setting;
Note: See TracChangeset for help on using the changeset viewer.