Changeset 16967 in josm


Ignore:
Timestamp:
2020-08-29T16:54:07+02:00 (8 weeks ago)
Author:
simon04
Message:

fix #19510 - Add "Zoom to layer" in context menu of layers in the Layers panel

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r16823 r16967  
    1212import java.util.Arrays;
    1313import java.util.Collection;
    14 import java.util.HashMap;
     14import java.util.EnumMap;
    1515import java.util.List;
    1616import java.util.Locale;
     
    251251    public final HistoryInfoWebAction historyinfoweb = new HistoryInfoWebAction();
    252252    /** View / "Zoom to"... actions */
    253     public final Map<String, AutoScaleAction> autoScaleActions = new HashMap<>();
     253    public final Map<AutoScaleMode, AutoScaleAction> autoScaleActions = new EnumMap<>(AutoScaleMode.class);
    254254    /** View / Jump to position */
    255255    public final JumpToAction jumpToAct = new JumpToAction();
     
    798798        for (AutoScaleMode mode : AutoScaleMode.values()) {
    799799            AutoScaleAction autoScaleAction = new AutoScaleAction(mode);
    800             autoScaleActions.put(mode.getEnglishLabel(), autoScaleAction);
     800            autoScaleActions.put(mode, autoScaleAction);
    801801            add(viewMenu, autoScaleAction);
    802802        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r16438 r16967  
    3838
    3939import org.openstreetmap.josm.actions.AbstractSelectAction;
     40import org.openstreetmap.josm.actions.AutoScaleAction;
    4041import org.openstreetmap.josm.actions.ExpertToggleAction;
    4142import org.openstreetmap.josm.command.Command;
     
    141142        createLayout(lstConflicts, true, Arrays.asList(btnResolve, btnSelect));
    142143
    143         popupMenuHandler.addAction(MainApplication.getMenu().autoScaleActions.get("conflict"));
     144        popupMenuHandler.addAction(MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.CONFLICT));
    144145
    145146        ResolveToMyVersionAction resolveToMyVersionAction = new ResolveToMyVersionAction();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r16438 r16967  
    140140        };
    141141
    142         popupMenuHandler.addAction(MainApplication.getMenu().autoScaleActions.get("problem"));
     142        popupMenuHandler.addAction(MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.PROBLEM));
    143143        popupMenuHandler.addAction(new EditRelationAction());
    144144        popupMenuHandler.addAction(ignoreForNowAction);
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r16913 r16967  
    7474import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
    7575import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource;
     76import org.openstreetmap.josm.actions.AutoScaleAction;
    7677import org.openstreetmap.josm.actions.ExpertToggleAction;
    7778import org.openstreetmap.josm.actions.ImageryAdjustAction;
     
    17521753            LayerListDialog.getInstance().createActivateLayerAction(this),
    17531754            LayerListDialog.getInstance().createShowHideLayerAction(),
     1755            MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.LAYER),
    17541756            LayerListDialog.getInstance().createDeleteLayerAction(),
    17551757            SeparatorLayerAction.INSTANCE,
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r16941 r16967  
    2525import javax.swing.SwingUtilities;
    2626
     27import org.openstreetmap.josm.actions.AutoScaleAction;
    2728import org.openstreetmap.josm.actions.ExpertToggleAction;
    2829import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener;
     
    265266                LayerListDialog.getInstance().createShowHideLayerAction(),
    266267                LayerListDialog.getInstance().createDeleteLayerAction(),
     268                MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.LAYER),
    267269                LayerListDialog.getInstance().createMergeLayerAction(this),
    268270                SeparatorLayerAction.INSTANCE,
  • trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java

    r16548 r16967  
    1616import java.io.IOException;
    1717import java.text.DateFormat;
    18 import java.util.ArrayList;
    1918import java.util.Collection;
    2019import java.util.Collections;
    21 import java.util.List;
    2220import java.util.Objects;
    2321import java.util.regex.Matcher;
     
    3533import javax.swing.text.View;
    3634
     35import org.openstreetmap.josm.actions.AutoScaleAction;
    3736import org.openstreetmap.josm.actions.SaveActionBase;
    3837import org.openstreetmap.josm.data.Bounds;
     
    405404    @Override
    406405    public Action[] getMenuEntries() {
    407         List<Action> actions = new ArrayList<>();
    408         actions.add(LayerListDialog.getInstance().createShowHideLayerAction());
    409         actions.add(LayerListDialog.getInstance().createDeleteLayerAction());
    410         actions.add(new LayerListPopup.InfoAction(this));
    411         actions.add(new LayerSaveAction(this));
    412         actions.add(new LayerSaveAsAction(this));
    413         return actions.toArray(new Action[0]);
     406        return new Action[]{
     407                LayerListDialog.getInstance().createShowHideLayerAction(),
     408                MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.LAYER),
     409                LayerListDialog.getInstance().createDeleteLayerAction(),
     410                new LayerListPopup.InfoAction(this),
     411                new LayerSaveAction(this),
     412                new LayerSaveAsAction(this),
     413        };
    414414    }
    415415
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r16913 r16967  
    5050import javax.swing.JScrollPane;
    5151
     52import org.openstreetmap.josm.actions.AutoScaleAction;
    5253import org.openstreetmap.josm.actions.ExpertToggleAction;
    5354import org.openstreetmap.josm.actions.RenameLayerAction;
     
    720721    @Override
    721722    public Action[] getMenuEntries() {
    722         List<Action> actions = new ArrayList<>();
    723         actions.addAll(Arrays.asList(
     723        List<Action> actions = new ArrayList<>(Arrays.asList(
    724724                LayerListDialog.getInstance().createActivateLayerAction(this),
    725725                LayerListDialog.getInstance().createShowHideLayerAction(),
     726                MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.LAYER),
    726727                LayerListDialog.getInstance().createDeleteLayerAction(),
    727728                SeparatorLayerAction.INSTANCE,
  • trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java

    r16553 r16967  
    8282    @Override
    8383    public Action[] getMenuEntries() {
    84         List<Action> ret = new ArrayList<>();
    85         ret.addAll(Arrays.asList(super.getMenuEntries()));
     84        List<Action> ret = new ArrayList<>(Arrays.asList(super.getMenuEntries()));
    8685        ret.add(SeparatorLayerAction.INSTANCE);
    8786        ret.add(new LayerSaveAction(this));
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r16913 r16967  
    3636import javax.swing.JOptionPane;
    3737
     38import org.openstreetmap.josm.actions.AutoScaleAction;
    3839import org.openstreetmap.josm.actions.RenameLayerAction;
    3940import org.openstreetmap.josm.actions.mapmode.SelectLassoAction;
     
    401402        entries.add(LayerListDialog.getInstance().createShowHideLayerAction());
    402403        entries.add(LayerListDialog.getInstance().createDeleteLayerAction());
     404        entries.add(MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.LAYER));
    403405        entries.add(LayerListDialog.getInstance().createMergeLayerAction(this));
    404406        entries.add(new RenameLayerAction(null, this));
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r16879 r16967  
    3030import javax.swing.JOptionPane;
    3131
     32import org.openstreetmap.josm.actions.AutoScaleAction;
    3233import org.openstreetmap.josm.actions.RenameLayerAction;
    3334import org.openstreetmap.josm.data.Bounds;
     
    247248        components.add(new ShowHideMarkerText(this));
    248249        components.add(LayerListDialog.getInstance().createDeleteLayerAction());
     250        components.add(MainApplication.getMenu().autoScaleActions.get(AutoScaleAction.AutoScaleMode.LAYER));
    249251        components.add(LayerListDialog.getInstance().createMergeLayerAction(this));
    250252        components.add(SeparatorLayerAction.INSTANCE);
Note: See TracChangeset for help on using the changeset viewer.