diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java index 94e8745d..0921f2f3 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayer.java @@ -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; @@ -131,8 +132,11 @@ public Object getInfoComponent() { @Override public Action[] getMenuEntries() { + Collection> forbiddenActions = Arrays.asList(LayerSaveAction.class, + LayerSaveAsAction.class, DuplicateAction.class, LayerGpxExportAction.class, + ConvertToGpxLayerAction.class); final List 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));