Changeset 5110 in josm for trunk


Ignore:
Timestamp:
2012-03-21T22:55:58+01:00 (8 years ago)
Author:
simon04
Message:

fix #7522 - fix "Fatal: failed to locate image" in MapPaintMenu

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

Legend:

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

    r5026 r5110  
    88
    99import javax.swing.AbstractAction;
     10import javax.swing.Icon;
    1011
    1112import org.openstreetmap.josm.Main;
     
    5253
    5354    /**
     55     * Constructs a {@code JosmAction}.
     56     *
     57     * @param name the action's text as displayed on the menu (if it is added to a menu)
     58     * @param icon the icon to use
     59     * @param tooltip  a longer description of the action that will be displayed in the tooltip. Please note
     60     *           that html is not supported for menu actions on some platforms.
     61     * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always
     62     *            do want a shortcut, remember you can always register it with group=none, so you
     63     *            won't be assigned a shortcut unless the user configures one. If you pass null here,
     64     *            the user CANNOT configure a shortcut for your action.
     65     * @param registerInToolbar register this action for the toolbar preferences?
     66     * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null
     67     * @param installAdapters false, if you don't want to install layer changed and selection changed adapters
     68     */
     69    public JosmAction(String name, Icon icon, String tooltip, Shortcut shortcut, boolean registerInToolbar, String toolbarId, boolean installAdapters) {
     70        super(name, icon);
     71        setHelpId();
     72        sc = shortcut;
     73        if (sc != null) {
     74            Main.registerActionShortcut(this, sc);
     75        }
     76        setTooltip(tooltip);
     77        if (getValue("toolbar") == null) {
     78            putValue("toolbar", toolbarId);
     79        }
     80        if (registerInToolbar) {
     81            Main.toolbar.register(this);
     82        }
     83        if (installAdapters) {
     84            installAdapters();
     85        }
     86    }
     87
     88    /**
    5489     * The new super for all actions.
    5590     *
     
    69104     */
    70105    public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, String toolbarId, boolean installAdapters) {
    71         super(name, iconName == null ? null : ImageProvider.get(iconName));
    72         setHelpId();
    73         sc = shortcut;
    74         if (sc != null) {
    75             Main.registerActionShortcut(this, sc);
    76         }
    77         setTooltip(tooltip);
    78         if (getValue("toolbar") == null) {
    79             putValue("toolbar", toolbarId == null ? iconName : toolbarId);
    80         }
    81         if (register) {
    82             Main.toolbar.register(this);
    83         }
    84         if (installAdapters) {
    85             installAdapters();
    86         }
     106        this(name, iconName == null ? null : ImageProvider.get(iconName), tooltip, shortcut, register,
     107                toolbarId == null ? iconName : toolbarId, installAdapters);
    87108    }
    88109
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java

    r5088 r5110  
    2424
    2525        public MapPaintAction(StyleSource style) {
    26             super(style.getDisplayString(), style.icon,
    27                     tr("Select the map painting styles"), null, style.icon != null);
    28             if (style.icon == null) {
    29                 putValue("toolbar", "mappaint/" + style.getDisplayString());
    30                 Main.toolbar.register(this);
    31             }
     26            super(style.getDisplayString(), ImageProvider.getIfAvailable(style.icon),
     27                    tr("Select the map painting styles"), null, true, "mappaint/" + style.getDisplayString(), true);
    3228            this.button = new StayOpenCheckBoxMenuItem(this);
    3329            this.style = style;
Note: See TracChangeset for help on using the changeset viewer.