Changeset 4733 in josm for trunk/src


Ignore:
Timestamp:
2011-12-28T18:59:27+01:00 (8 years ago)
Author:
bastiK
Message:

fixed #7174 - identifier for toolbar actions is icon name

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

Legend:

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

    r4139 r4733  
    5353     * The new super for all actions.
    5454     *
    55      * Use this super constructor to setup your action. It takes 5 parameters:
     55     * Use this super constructor to setup your action.
    5656     *
    5757     * @param name the action's text as displayed on the menu (if it is added to a menu)
     
    6464     *            the user CANNOT configure a shortcut for your action.
    6565     * @param register register this action for the toolbar preferences?
    66      */
    67     public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register) {
    68         this(name, iconName, tooltip, shortcut, register, true);
    69     }
    70 
    71     /**
    72      * Even newer super for all actions. Use if you don't want to install layer changed and selection changed adapters
    73      * @param name
    74      * @param iconName
    75      * @param tooltip
    76      * @param shortcut
    77      * @param register
    78      * @param installAdapters
    79      */
    80     public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, boolean installAdapters) {
     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, String iconName, String tooltip, Shortcut shortcut, boolean register, String toolbarId, boolean installAdapters) {
    8170        super(name, iconName == null ? null : ImageProvider.get(iconName));
    8271        setHelpId();
     
    8776        putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
    8877        if (getValue("toolbar") == null) {
    89             putValue("toolbar", iconName);
     78            putValue("toolbar", toolbarId == null ? iconName : toolbarId);
    9079        }
    9180        if (register) {
     
    9584            installAdapters();
    9685        }
     86    }
     87
     88    public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, boolean installAdapters) {
     89        this(name, iconName, tooltip, shortcut, register, null, installAdapters);
     90    }
     91
     92    public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register) {
     93        this(name, iconName, tooltip, shortcut, register, null, true);
    9794    }
    9895
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r4695 r4733  
    2626public class SessionLoadAction extends JosmAction {
    2727    public SessionLoadAction() {
    28         super(tr("Load Session"), "open", tr("Load a session from file."), null, false);
     28        super(tr("Load Session"), "open", tr("Load a session from file."), null, true, "load-session", true);
    2929        putValue("help", ht("/Action/SessionLoad"));
    3030    }
  • trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

    r4685 r4733  
    4242import org.openstreetmap.josm.tools.WindowGeometry;
    4343
    44 public class SessionSaveAsAction extends DiskAccessAction {
     44public class SessionSaveAsAction extends JosmAction {
    4545
    4646    private List<Layer> layers;
     
    5555     */
    5656    public SessionSaveAsAction() {
    57         super(tr("Save Session As..."), "save_as", tr("Save the current session to a new file."), null);
     57        super(tr("Save Session As..."), "save_as", tr("Save the current session to a new file."), null, true, "save_as-session", true);
    5858        putValue("help", ht("/Action/SessionSaveAs"));
    5959    }
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r4685 r4733  
    120120    public final JosmAction save = new SaveAction();
    121121    public final JosmAction saveAs = new SaveAsAction();
    122     public final JosmAction sessionLoad = new SessionLoadAction();
    123     public final JosmAction sessionSaveAs = new SessionSaveAsAction();
     122    public JosmAction sessionLoad;
     123    public JosmAction sessionSaveAs;
    124124    public final JosmAction gpxExport = new GpxExportAction();
    125125    public final DownloadAction download = new DownloadAction();
     
    367367            sessionMenu.setToolTipText(tr("Save and load the current session (list of layers, etc.)"));
    368368            sessionMenu.setIcon(ImageProvider.get("session"));
     369            sessionSaveAs = new SessionSaveAsAction();
     370            sessionLoad = new SessionLoadAction();
    369371            add(sessionMenu, sessionSaveAs);
    370372            add(sessionMenu, sessionLoad);
Note: See TracChangeset for help on using the changeset viewer.