Changeset 11654 in josm for trunk/src


Ignore:
Timestamp:
2017-03-03T22:37:42+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14450 - Cannot add local imagery to toolbar

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

Legend:

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

    r11635 r11654  
    6464     */
    6565    public AddImageryLayerAction(ImageryInfo info) {
    66         super(info.getMenuName(), /* ICON */"imagery_menu", tr("Add imagery layer {0}", info.getName()), null, false, false);
    67         putValue("toolbar", "imagery_" + info.getToolbarName());
     66        super(info.getMenuName(), /* ICON */"imagery_menu", tr("Add imagery layer {0}", info.getName()), null,
     67                true, "imagery_" + info.getToolbarName(), false);
    6868        putValue("help", ht("/Preferences/Imagery"));
    6969        setTooltip(info.getToolTipText().replaceAll("</?html>", ""));
     
    203203        }
    204204    }
     205
     206    @Override
     207    public String toString() {
     208        return "AddImageryLayerAction [info=" + info + ']';
     209    }
    205210}
  • trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java

    r11348 r11654  
    1515import java.util.List;
    1616import java.util.Locale;
     17import java.util.Optional;
    1718
    1819import javax.swing.Action;
     
    264265
    265266    /**
    266      * Remove all the items in @field dynamicItems collection
     267     * Remove all the items in dynamic items collection
    267268     * @since 5803
    268269     */
     
    270271        for (Object item : dynamicItems) {
    271272            if (item instanceof JMenuItem) {
     273                Optional.ofNullable(((JMenuItem) item).getAction()).ifPresent(Main.toolbar::unregister);
    272274                remove((JMenuItem) item);
    273             }
    274             if (item instanceof MenuComponent) {
     275            } else if (item instanceof MenuComponent) {
    275276                remove((MenuComponent) item);
    276             }
    277             if (item instanceof Component) {
     277            } else if (item instanceof Component) {
    278278                remove((Component) item);
    279279            }
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r11553 r11654  
    939939                selected.addElement(actionDefinition);
    940940            }
     941            actionsTreeModel.reload();
    941942        }
    942943
     
    10771078
    10781079    /**
     1080     * Registers an action to the toolbar preferences.
    10791081     * @param action Action to register
    10801082     * @return The parameter (for better chaining)
     
    10961098        }
    10971099        return action;
     1100    }
     1101
     1102    /**
     1103     * Unregisters an action from the toolbar preferences.
     1104     * @param action Action to unregister
     1105     * @return The removed action, or null
     1106     * @since 11654
     1107     */
     1108    public Action unregister(Action action) {
     1109        String toolbar = (String) action.getValue("toolbar");
     1110        if (toolbar != null) {
     1111            return regactions.remove(toolbar);
     1112        }
     1113        return null;
    10981114    }
    10991115
Note: See TracChangeset for help on using the changeset viewer.