Changeset 34497 in osm for applications/editors/josm


Ignore:
Timestamp:
2018-08-18T03:15:04+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/colorscheme
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/colorscheme/build.xml

    r34091 r34497  
    55    <property name="commit.message" value="Uses new constructor for Plugin"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="12987"/>
     7    <property name="plugin.main.version" value="14153"/>
    88
    99    <property name="plugin.author" value="Christof Dallermassl"/>
  • applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePreference.java

    r34095 r34497  
    2626import javax.swing.JScrollPane;
    2727
    28 import org.openstreetmap.josm.Main;
     28import org.openstreetmap.josm.data.Preferences;
    2929import org.openstreetmap.josm.data.preferences.ColorInfo;
     30import org.openstreetmap.josm.gui.MainApplication;
    3031import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    3132import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
     
    3334import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
    3435import org.openstreetmap.josm.gui.preferences.display.ColorPreference;
     36import org.openstreetmap.josm.spi.preferences.Config;
    3537import org.openstreetmap.josm.tools.ColorHelper;
    3638import org.openstreetmap.josm.tools.GBC;
     
    5658        panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    5759
    58         Map<String, String> colorMap = Main.pref.getAllPrefix(PREF_KEY_COLOR_PREFIX);
     60        Map<String, String> colorMap = Preferences.main().getAllPrefix(PREF_KEY_COLOR_PREFIX);
    5961        colorKeys = new ArrayList<>(colorMap.keySet());
    6062        Collections.sort(colorKeys);
    6163        listModel = new DefaultListModel<>();
    6264        schemesList = new JList<>(listModel);
    63         String schemes = Main.pref.get(PREF_KEY_SCHEMES_NAMES);
     65        String schemes = Config.getPref().get(PREF_KEY_SCHEMES_NAMES);
    6466        StringTokenizer st = new StringTokenizer(schemes, ";");
    6567        String schemeName;
     
    7274        useScheme.addActionListener(e -> {
    7375            if (schemesList.getSelectedIndex() == -1)
    74                 JOptionPane.showMessageDialog(Main.parent, tr("Please select a scheme to use."));
     76                JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Please select a scheme to use."));
    7577            else {
    7678                String schemeName1 = (String) listModel.get(schemesList.getSelectedIndex());
     
    8082        JButton addScheme = new JButton(tr("Add"));
    8183        addScheme.addActionListener(e -> {
    82             String schemeName1 = JOptionPane.showInputDialog(Main.parent, tr("Color Scheme"));
     84            String schemeName1 = JOptionPane.showInputDialog(MainApplication.getMainFrame(), tr("Color Scheme"));
    8385            if (schemeName1 == null)
    8486                return;
     
    9294        deleteScheme.addActionListener(e -> {
    9395            if (schemesList.getSelectedIndex() == -1)
    94                 JOptionPane.showMessageDialog(Main.parent, tr("Please select the scheme to delete."));
     96                JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Please select the scheme to delete."));
    9597            else {
    9698                String schemeName1 = (String) listModel.get(schemesList.getSelectedIndex());
     
    133135            for (int i = 0; i < schemesList.getModel().getSize(); ++i)
    134136                sb.append(";"+schemesList.getModel().getElementAt(i));
    135             Main.pref.put(PREF_KEY_SCHEMES_NAMES, sb.toString().substring(1));
     137            Config.getPref().put(PREF_KEY_SCHEMES_NAMES, sb.toString().substring(1));
    136138        } else
    137             Main.pref.put(PREF_KEY_SCHEMES_NAMES, null);
     139            Config.getPref().put(PREF_KEY_SCHEMES_NAMES, null);
    138140    }
    139141
     
    154156    public void removeColorSchemeFromPreferences(String schemeName) {
    155157        // delete color entries for scheme in preferences:
    156         Map<String, String> colors = Main.pref.getAllPrefix(PREF_KEY_SCHEMES_PREFIX + schemeName + ".");
     158        Map<String, String> colors = Preferences.main().getAllPrefix(PREF_KEY_SCHEMES_PREFIX + schemeName + ".");
    157159        for(String key : colors.keySet()) {
    158             Main.pref.put(key, null);
     160            Config.getPref().put(key, null);
    159161        }
    160162    }
     
    169171        for(String colorKey : colorMap.keySet()) {
    170172            key = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX + colorKey;
    171             Main.pref.put(key, ColorHelper.color2html(colorMap.get(colorKey).getValue()));
     173            Config.getPref().put(key, ColorHelper.color2html(colorMap.get(colorKey).getValue()));
    172174        }
    173175    }
     
    183185        String prefix = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX;
    184186        Map<String, ColorInfo> colorMap = new HashMap<>();
    185         for(String schemeColorKey : Main.pref.getAllPrefix(prefix).keySet()) {
     187        for(String schemeColorKey : Preferences.main().getAllPrefix(prefix).keySet()) {
    186188            colorKey = schemeColorKey.substring(prefix.length());
    187189            colorMap.put(colorKey, ColorInfo.fromPref(Arrays.asList(
    188190                    // FIXME: does not work, corrupts the color table ? See #16110
    189                     Main.pref.get(schemeColorKey), "", "", ""), false));
     191                    Config.getPref().get(schemeColorKey), "", "", ""), false));
    190192        }
    191193        return colorMap;
Note: See TracChangeset for help on using the changeset viewer.