- Timestamp:
- 2015-10-04T12:19:24+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r8789 r8818 864 864 setEnabled(false); 865 865 } else if (getModel().getSelectedLayers().size() > 1) { 866 Layer firstLayer = getModel().getSelectedLayers().get(0); 867 for (Layer l: getModel().getSelectedLayers()) { 868 if (l != firstLayer && (!l.isMergable(firstLayer) || !firstLayer.isMergable(l))) { 869 setEnabled(false); 870 return; 871 } 872 } 873 setEnabled(true); 866 setEnabled(supportLayers(getModel().getSelectedLayers())); 874 867 } else { 875 868 Layer selectedLayer = getModel().getSelectedLayers().get(0); … … 887 880 @Override 888 881 public boolean supportLayers(List<Layer> layers) { 889 for (Layer l : layers) { 890 if (!(l instanceof OsmDataLayer)) { 891 return false; 892 } 893 } 894 return true; 882 if (layers.size() < 1) { 883 return false; 884 } else { 885 final Layer firstLayer = layers.get(0); 886 final List<Layer> remainingLayers = layers.subList(1, layers.size()); 887 return getModel().getPossibleMergeTargets(firstLayer).containsAll(remainingLayers); 888 } 895 889 } 896 890 … … 1504 1498 public List<Layer> getPossibleMergeTargets(Layer source) { 1505 1499 List<Layer> targets = new ArrayList<>(); 1506 if (source == null )1500 if (source == null || !Main.isDisplayingMapView()) { 1507 1501 return targets; 1508 for (Layer target : getLayers()) { 1502 } 1503 for (Layer target : Main.map.mapView.getAllLayersAsList()) { 1509 1504 if (source == target) { 1510 1505 continue; -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r8804 r8818 185 185 LayerListDialog.getInstance().createShowHideLayerAction(), 186 186 LayerListDialog.getInstance().createDeleteLayerAction(), 187 LayerListDialog.getInstance().createMergeLayerAction(this), 187 188 SeparatorLayerAction.INSTANCE, 188 189 new LayerSaveAction(this), -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r8734 r8818 335 335 entries.add(LayerListDialog.getInstance().createShowHideLayerAction()); 336 336 entries.add(LayerListDialog.getInstance().createDeleteLayerAction()); 337 entries.add(LayerListDialog.getInstance().createMergeLayerAction(this)); 337 338 entries.add(new RenameLayerAction(null, this)); 338 339 entries.add(SeparatorLayerAction.INSTANCE); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r8806 r8818 253 253 components.add(new ShowHideMarkerText(this)); 254 254 components.add(LayerListDialog.getInstance().createDeleteLayerAction()); 255 components.add(LayerListDialog.getInstance().createMergeLayerAction(this)); 255 256 components.add(SeparatorLayerAction.INSTANCE); 256 257 components.add(new CustomizeColor(this));
Note:
See TracChangeset
for help on using the changeset viewer.