Changeset 8819 in josm


Ignore:
Timestamp:
2015-10-04T12:28:59+02:00 (4 years ago)
Author:
simon04
Message:

see #11897 - MergeLayerAction: merge active layer instead of edit layer

This allows merging of gpx/marker/geoimage layers using [CTRL]+[M].

File:
1 edited

Legend:

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

    r8510 r8819  
    9595    @Override
    9696    public void actionPerformed(ActionEvent e) {
    97         Layer sourceLayer = Main.main.getEditLayer();
    98         if (sourceLayer == null)
    99             return;
    100         merge(sourceLayer);
     97        merge(getSourceLayer());
    10198    }
    10299
     
    106103            @Override
    107104            public void run() {
    108                 if (getEditLayer() == null) {
     105                final Layer sourceLayer = getSourceLayer();
     106                if (sourceLayer == null) {
    109107                    setEnabled(false);
    110                     return;
     108                } else {
     109                    final List<Layer> possibleMergeTargets = LayerListDialog.getInstance().getModel().getPossibleMergeTargets(sourceLayer);
     110                    setEnabled(!possibleMergeTargets.isEmpty());
    111111                }
    112                 setEnabled(!LayerListDialog.getInstance().getModel().getPossibleMergeTargets(getEditLayer()).isEmpty());
    113112            }
    114113        });
     114    }
     115
     116    protected Layer getSourceLayer() {
     117        return Main.map != null ? Main.main.getActiveLayer() : null;
    115118    }
    116119
Note: See TracChangeset for help on using the changeset viewer.