Changeset 11657 in josm for trunk/src/org
- Timestamp:
- 2017-03-03T23:38:13+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r11654 r11657 30 30 import org.openstreetmap.josm.gui.layer.AlignImageryPanel; 31 31 import org.openstreetmap.josm.gui.layer.ImageryLayer; 32 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; 32 33 import org.openstreetmap.josm.gui.preferences.imagery.WMSLayerTree; 33 34 import org.openstreetmap.josm.gui.util.GuiHelper; … … 65 66 public AddImageryLayerAction(ImageryInfo info) { 66 67 super(info.getMenuName(), /* ICON */"imagery_menu", tr("Add imagery layer {0}", info.getName()), null, 67 true, "imagery_"+ info.getToolbarName(), false);68 true, ToolbarPreferences.IMAGERY_PREFIX + info.getToolbarName(), false); 68 69 putValue("help", ht("/Preferences/Imagery")); 69 70 setTooltip(info.getToolTipText().replaceAll("</?html>", "")); -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r11654 r11657 62 62 import org.openstreetmap.josm.actions.ActionParameter; 63 63 import org.openstreetmap.josm.actions.AdaptableAction; 64 import org.openstreetmap.josm.actions.AddImageryLayerAction; 64 65 import org.openstreetmap.josm.actions.JosmAction; 65 66 import org.openstreetmap.josm.actions.ParameterizedAction; 66 67 import org.openstreetmap.josm.actions.ParameterizedActionDecorator; 68 import org.openstreetmap.josm.data.imagery.ImageryInfo; 69 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 67 70 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 68 71 import org.openstreetmap.josm.tools.GBC; … … 77 80 78 81 private static final String EMPTY_TOOLBAR_MARKER = "<!-empty-!>"; 82 83 /** 84 * The prefix for imagery toolbar entries. 85 * @since 11657 86 */ 87 public static final String IMAGERY_PREFIX = "imagery_"; 79 88 80 89 /** … … 253 262 } 254 263 264 /** 265 * Loads the action definition from its toolbar name. 266 * @param actionName action toolbar name 267 * @return action definition or null 268 */ 255 269 public ActionDefinition loadAction(String actionName) { 256 270 index = 0; … … 259 273 String name = readTillChar('(', '{'); 260 274 Action action = actions.get(name); 275 276 if (action == null && name.startsWith(IMAGERY_PREFIX)) { 277 String imageryName = name.substring(IMAGERY_PREFIX.length()); 278 for (ImageryInfo i : ImageryLayerInfo.instance.getDefaultLayers()) { 279 if (imageryName.equalsIgnoreCase(i.getName())) { 280 action = new AddImageryLayerAction(i); 281 break; 282 } 283 } 284 } 261 285 262 286 if (action == null) … … 1007 1031 String toolbar = (String) tb; 1008 1032 Action r = actions.get(toolbar); 1009 if (r != null && r != action && !toolbar.startsWith( "imagery_")) {1033 if (r != null && r != action && !toolbar.startsWith(IMAGERY_PREFIX)) { 1010 1034 Main.info(tr("Toolbar action {0} overwritten: {1} gets {2}", 1011 1035 toolbar, r.getClass().getName(), action.getClass().getName()));
Note:
See TracChangeset
for help on using the changeset viewer.