Skip to content

Commit

Permalink
Fix JOSM-20388, attempting to duplicate a MapWithAI layer
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Jan 14, 2021
1 parent 520a50f commit 946593f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.gui.MainApplication;
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.MainLayerManager.ActiveLayerChangeEvent;
import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
Expand Down Expand Up @@ -131,8 +132,11 @@ public Object getInfoComponent() {

@Override
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()
.filter(action -> !(action instanceof LayerSaveAction) && !(action instanceof LayerSaveAsAction))
.filter(action -> forbiddenActions.stream().noneMatch(clazz -> clazz.isInstance(action)))
.collect(Collectors.toCollection(ArrayList::new));
if (actions.isEmpty()) {
actions.add(new ContinuousDownloadAction(this));
Expand Down

0 comments on commit 946593f

Please sign in to comment.