kopia lustrzana https://github.com/JOSM/MapWithAI
Fix JOSM-20388, attempting to duplicate a MapWithAI layer
Signed-off-by: Taylor Smock <tsmock@fb.com>pull/1/head
rodzic
abf49ffdab
commit
b3c0e37f80
|
@ -41,6 +41,7 @@ import org.openstreetmap.josm.data.osm.UploadPolicy;
|
||||||
import org.openstreetmap.josm.data.osm.Way;
|
import org.openstreetmap.josm.data.osm.Way;
|
||||||
import org.openstreetmap.josm.gui.MainApplication;
|
import org.openstreetmap.josm.gui.MainApplication;
|
||||||
import org.openstreetmap.josm.gui.Notification;
|
import org.openstreetmap.josm.gui.Notification;
|
||||||
|
import org.openstreetmap.josm.gui.dialogs.layer.DuplicateAction;
|
||||||
import org.openstreetmap.josm.gui.layer.Layer;
|
import org.openstreetmap.josm.gui.layer.Layer;
|
||||||
import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
|
import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
|
||||||
import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
|
import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
|
||||||
|
@ -149,8 +150,11 @@ public class MapWithAILayer extends OsmDataLayer implements ActiveLayerChangeLis
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Action[] getMenuEntries() {
|
public Action[] getMenuEntries() {
|
||||||
|
Collection<Class<? extends Action>> forbiddenActions = Arrays.asList(LayerSaveAction.class,
|
||||||
|
LayerSaveAsAction.class, DuplicateAction.class, LayerGpxExportAction.class,
|
||||||
|
ConvertToGpxLayerAction.class);
|
||||||
final List<Action> actions = Arrays.asList(super.getMenuEntries()).stream()
|
final List<Action> actions = Arrays.asList(super.getMenuEntries()).stream()
|
||||||
.filter(action -> !(action instanceof LayerSaveAction) && !(action instanceof LayerSaveAsAction))
|
.filter(action -> forbiddenActions.stream().noneMatch(clazz -> clazz.isInstance(action)))
|
||||||
.collect(Collectors.toCollection(ArrayList::new));
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
if (actions.isEmpty()) {
|
if (actions.isEmpty()) {
|
||||||
actions.add(new ContinuousDownloadAction(this));
|
actions.add(new ContinuousDownloadAction(this));
|
||||||
|
|
Ładowanie…
Reference in New Issue