Changeset 16138 in josm for trunk/src/org


Ignore:
Timestamp:
2020-03-15T19:15:04+01:00 (5 years ago)
Author:
Don-vip
Message:

see #18933 - toolbar code refactoring

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

Legend:

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

    r13434 r16138  
    2929                KeyEvent.VK_C, Shortcut.CTRL_SHIFT),
    3030                false);
    31         putValue("toolbar", "copy/coordinates");
     31        setToolbarId("copy/coordinates");
    3232    }
    3333
  • trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java

    r15649 r16138  
    115115              false /* register toolbar */
    116116        );
    117         putValue("toolbar", "expertmode");
     117        setToolbarId("expertmode");
    118118        if (MainApplication.getToolbar() != null) {
    119119            MainApplication.getToolbar().register(this);
  • trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java

    r14397 r16138  
    4444        );
    4545        setHelpId(ht("/Action/FullscreenView"));
    46         putValue("toolbar", "fullscreen");
     46        setToolbarId("fullscreen");
    4747        MainApplication.getToolbar().register(this);
    4848        gd = GraphicsEnvironment.isHeadless() ? null : GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
  • trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java

    r16123 r16138  
    3636                        tr("History"), KeyEvent.VK_H, Shortcut.CTRL), false);
    3737        setHelpId(ht("/Action/ObjectHistory"));
    38         putValue("toolbar", "action/historyinfo");
     38        setToolbarId("action/historyinfo");
    3939        MainApplication.getToolbar().register(this);
    4040        setEnabled(true);
  • trunk/src/org/openstreetmap/josm/actions/JosmAction.java

    r15588 r16138  
    2424import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    2525import org.openstreetmap.josm.gui.MainApplication;
     26import org.openstreetmap.josm.gui.help.HelpUtil;
    2627import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
    2728import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     
    7576     *            the user CANNOT configure a shortcut for your action.
    7677     * @param registerInToolbar register this action for the toolbar preferences?
    77      * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null
     78     * @param toolbarId identifier for the toolbar preferences
    7879     * @param installAdapters false, if you don't want to install layer changed and selection changed adapters
    7980     */
     
    99100        setTooltip(tooltip);
    100101        if (getValue("toolbar") == null) {
    101             putValue("toolbar", toolbarId);
     102            setToolbarId(toolbarId);
    102103        }
    103104        if (registerInToolbar && MainApplication.getToolbar() != null) {
     
    292293    }
    293294
     295    /**
     296     * Sets the help topic id.
     297     * @param helpId help topic id (result of {@link HelpUtil#ht})
     298     * @since 14397
     299     */
    294300    protected void setHelpId(String helpId) {
    295301        putValue("help", helpId);
     302    }
     303
     304    /**
     305     * Sets the toolbar id.
     306     * @param toolbarId toolbar id
     307     * @since 16138
     308     */
     309    protected void setToolbarId(String toolbarId) {
     310        putValue("toolbar", toolbarId);
    296311    }
    297312
  • trunk/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java

    r14149 r16138  
    3131    public PreferenceToggleAction(String name, String tooltip, String prefKey, boolean prefDefault) {
    3232        super(name, null, tooltip, null, false);
    33         putValue("toolbar", "toggle-" + prefKey);
     33        setToolbarId("toggle-" + prefKey);
    3434        this.pref = new BooleanProperty(prefKey, prefDefault);
    3535        checkbox = new JCheckBoxMenuItem(this);
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r14397 r16138  
    5151                Shortcut.registerShortcut("file:restart", tr("File: {0}", tr("Restart")), KeyEvent.VK_J, Shortcut.ALT_CTRL_SHIFT), false);
    5252        setHelpId(ht("/Action/Restart"));
    53         putValue("toolbar", "action/restart");
     53        setToolbarId("action/restart");
    5454        if (MainApplication.getToolbar() != null) {
    5555            MainApplication.getToolbar().register(this);
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r15849 r16138  
    6767
    6868        setHelpId(ht("/Action/ShowStatusReport"));
    69         putValue("toolbar", "help/showstatusreport");
     69        setToolbarId("help/showstatusreport");
    7070        MainApplication.getToolbar().register(this);
    7171    }
  • trunk/src/org/openstreetmap/josm/actions/TaggingPresetSearchAction.java

    r14390 r16138  
    2424        super(tr("Search preset..."), "dialogs/search", tr("Show preset search dialog"),
    2525                Shortcut.registerShortcut("preset:search", tr("Search presets"), KeyEvent.VK_F3, Shortcut.DIRECT), false);
    26         putValue("toolbar", "presets/search");
     26        setToolbarId("presets/search");
    2727        MainApplication.getToolbar().register(this);
    2828    }
  • trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java

    r13926 r16138  
    3030              false /* register toolbar */
    3131        );
    32         putValue("toolbar", "wireframe");
     32        setToolbarId("wireframe");
    3333        MainApplication.getToolbar().register(this);
    3434        setSelected(MapRendererFactory.getInstance().isWireframeMapRendererActive());
  • trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java

    r14153 r16138  
    66import java.awt.event.KeyEvent;
    77import java.awt.event.MouseEvent;
     8import java.util.Objects;
    89
    910import javax.swing.JOptionPane;
     
    1718import org.openstreetmap.josm.gui.Notification;
    1819import org.openstreetmap.josm.gui.util.KeyPressReleaseListener;
    19 import org.openstreetmap.josm.tools.CheckParameterUtil;
    2020import org.openstreetmap.josm.tools.ImageProvider;
    2121import org.openstreetmap.josm.tools.Logging;
     
    3737        super(tr("Add a new Note"), "addnote", tr("Add note mode"),
    3838            ImageProvider.getCursor("crosshair", "create_note"));
    39         CheckParameterUtil.ensureParameterNotNull(data, "data");
    40         noteData = data;
     39        noteData = Objects.requireNonNull(data, "data");
    4140    }
    4241
  • trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java

    r16096 r16138  
    5656        AdjustImageryOffsetAction() {
    5757            super(tr("Imagery offset"), "mapmode/adjustimg", tr("Adjust imagery offset"), null, false, false);
    58             putValue("toolbar", "imagery-offset");
     58            setToolbarId("imagery-offset");
    5959            MainApplication.getToolbar().register(this);
    6060        }
Note: See TracChangeset for help on using the changeset viewer.