Ignore:
Timestamp:
2017-09-13T23:24:50+02:00 (7 years ago)
Author:
bastiK
Message:

see #15229 - use Config.getPref() wherever possible

File:
1 edited

Legend:

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

    r12841 r12846  
    7171import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
    7272import org.openstreetmap.josm.gui.util.GuiHelper;
     73import org.openstreetmap.josm.spi.preferences.Config;
    7374import org.openstreetmap.josm.tools.GBC;
    7475import org.openstreetmap.josm.tools.ImageProvider;
     
    488489        private void setActionAndAdapt(ActionDefinition action) {
    489490            this.act = action;
    490             doNotHide.setSelected(Main.pref.getBoolean("toolbar.always-visible", true));
     491            doNotHide.setSelected(Config.getPref().getBoolean("toolbar.always-visible", true));
    491492            remove.setVisible(act != null);
    492493            shortcutEdit.setVisible(act != null);
     
    502503                // remove the button from toolbar preferences
    503504                t.remove(res);
    504                 Main.pref.putList("toolbar", t);
     505                Config.getPref().putList("toolbar", t);
    505506                MainApplication.getToolbar().refreshToolbarControl();
    506507            }
     
    532533            public void actionPerformed(ActionEvent e) {
    533534                boolean sel = ((JCheckBoxMenuItem) e.getSource()).getState();
    534                 Main.pref.putBoolean("toolbar.always-visible", sel);
    535                 Main.pref.putBoolean("menu.always-visible", sel);
     535                Config.getPref().putBoolean("toolbar.always-visible", sel);
     536                Config.getPref().putBoolean("menu.always-visible", sel);
    536537            }
    537538        });
     
    987988                t = Collections.singletonList(EMPTY_TOOLBAR_MARKER);
    988989            }
    989             Main.pref.putList("toolbar", t);
     990            Config.getPref().putList("toolbar", t);
    990991            MainApplication.getToolbar().refreshToolbarControl();
    991992            return false;
     
    10021003            control.setComponentPopupMenu(popupMenu);
    10031004        });
    1004         Main.pref.addPreferenceChangeListener(e -> {
     1005        Config.getPref().addPreferenceChangeListener(e -> {
    10051006            if ("toolbar.visible".equals(e.getKey())) {
    10061007                refreshToolbarControl();
     
    10741075    public static Collection<String> getToolString() {
    10751076
    1076         Collection<String> toolStr = Main.pref.getList("toolbar", Arrays.asList(deftoolbar));
     1077        Collection<String> toolStr = Config.getPref().getList("toolbar", Arrays.asList(deftoolbar));
    10771078        if (toolStr == null || toolStr.isEmpty()) {
    10781079            toolStr = Arrays.asList(deftoolbar);
     
    11881189        }
    11891190
    1190         boolean visible = Main.pref.getBoolean("toolbar.visible", true);
     1191        boolean visible = Config.getPref().getBoolean("toolbar.visible", true);
    11911192
    11921193        control.setFocusTraversalKeysEnabled(!unregisterTab);
     
    12141215            }
    12151216        }
    1216         Main.pref.putList("toolbar", t);
     1217        Config.getPref().putList("toolbar", t);
    12171218        MainApplication.getToolbar().refreshToolbarControl();
    12181219    }
Note: See TracChangeset for help on using the changeset viewer.