Changeset 16529 in josm


Ignore:
Timestamp:
2020-05-31T17:09:04+02:00 (4 years ago)
Author:
simon04
Message:

PreferenceToggleAction: accept BooleanProperty in constructor

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DrawBoundariesOfDownloadedDataAction.java

    r16509 r16529  
    2222        super(tr("Draw boundaries of downloaded data"),
    2323                tr("Enable/disable hatched background rendering of areas outside of the downloaded areas."),
    24                 DrawingPreference.SOURCE_BOUNDS_PROP.getKey(),
    25                 DrawingPreference.SOURCE_BOUNDS_PROP.getDefaultValue()
     24                DrawingPreference.SOURCE_BOUNDS_PROP
    2625        );
    2726    }
  • trunk/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java

    r16138 r16529  
    2626     * @param name the (translated) title
    2727     * @param tooltip tooltip text
    28      * @param prefKey the preference key to toggle
    29      * @param prefDefault default value for the preference entry
     28     * @param pref the preference to toggle
    3029     */
    31     public PreferenceToggleAction(String name, String tooltip, String prefKey, boolean prefDefault) {
     30    public PreferenceToggleAction(String name, String tooltip, BooleanProperty pref) {
    3231        super(name, null, tooltip, null, false);
    33         setToolbarId("toggle-" + prefKey);
    34         this.pref = new BooleanProperty(prefKey, prefDefault);
     32        setToolbarId("toggle-" + pref.getKey());
     33        this.pref = pref;
    3534        checkbox = new JCheckBoxMenuItem(this);
    3635        checkbox.setSelected(pref.get());
    37         Preferences.main().addWeakKeyPreferenceChangeListener(prefKey, this);
     36        Preferences.main().addWeakKeyPreferenceChangeListener(pref.getKey(), this);
    3837    }
    3938
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r16528 r16529  
    823823        viewMenu.add(new PreferenceToggleAction(tr("Main toolbar"),
    824824                tr("Toggles the visibility of the main toolbar (i.e., the horizontal toolbar)"),
    825                 MapFrame.TOOLBAR_VISIBLE.getKey(), MapFrame.TOOLBAR_VISIBLE.getDefaultValue()).getCheckbox());
     825                MapFrame.TOOLBAR_VISIBLE).getCheckbox());
    826826        viewMenu.add(new PreferenceToggleAction(tr("Edit toolbar"),
    827827                tr("Toggles the visibility of the edit toolbar (i.e., the vertical tool)"),
    828                 MapFrame.SIDE_TOOLBAR_VISIBLE.getKey(), MapFrame.SIDE_TOOLBAR_VISIBLE.getDefaultValue()).getCheckbox());
     828                MapFrame.SIDE_TOOLBAR_VISIBLE).getCheckbox());
    829829        // -- dialogs panel toggle action
    830830        final JCheckBoxMenuItem dialogsToggle = new JCheckBoxMenuItem(dialogsToggleAction);
Note: See TracChangeset for help on using the changeset viewer.