From 7986d7e5b7d599527c456912a45e06ebdb52c0ac Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 22 Dec 2020 16:16:59 -0700 Subject: [PATCH] MapWithAILayer: Don't allow MapWithAI data to be merged into a OSM data layer. Signed-off-by: Taylor Smock --- .../plugins/mapwithai/backend/MapWithAILayer.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 e48233c3..d6a4326f 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 @@ -6,6 +6,8 @@ import java.awt.Component; import java.awt.event.ActionEvent; import java.io.File; +import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -299,4 +301,16 @@ public Component createMenuComponent() { } } + + @Override + public boolean autosave(File file) throws IOException { + // Consider a deletion a "successful" save. + return Files.deleteIfExists(file.toPath()); + } + + @Override + public boolean isMergable(final Layer other) { + // Don't allow this layer to be merged down + return other instanceof MapWithAILayer; + } }