From 10e3ad76a7a40419880242d0ca5325e206676cf6 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 7 Oct 2020 07:27:58 -0600 Subject: [PATCH] FIXUP: Don't show preview data sets when expert mode is not checked This fixes #99. This also changes the default classpath for the JRE, so that it hopefully just works on different machines. The minimum JOSM version is also bumped to the current stable. Signed-off-by: Taylor Smock --- .classpath | 2 +- gradle.properties | 4 ++-- .../plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java | 5 +++-- .../mapwithai/gui/preferences/MapWithAIPreferences.java | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.classpath b/.classpath index 3bf48b8..f347d6e 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + diff --git a/gradle.properties b/gradle.properties index 6b0cc09..613ae64 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ # The minimum JOSM version this plugin is compatible with (can be any numeric version -plugin.main.version = 16846 +plugin.main.version = 17084 # The JOSM version this plugin is currently compiled against # Please make sure this version is available at https://josm.openstreetmap.de/download # The special values "latest" and "tested" are also possible here, but not recommended. -plugin.compile.version = 17023 +plugin.compile.version = 17084 plugin.canloadatruntime = true plugin.author = Taylor Smock plugin.class = org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java index 15614e1..7727b8e 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAILayerInfo.java @@ -21,6 +21,7 @@ import java.util.stream.Collectors; import javax.swing.SwingUtilities; +import org.openstreetmap.josm.actions.ExpertToggleAction; import org.openstreetmap.josm.data.StructUtils; import org.openstreetmap.josm.data.imagery.ImageryInfo; import org.openstreetmap.josm.data.preferences.BooleanProperty; @@ -45,7 +46,7 @@ public class MapWithAILayerInfo { /** * A boolean preference used to determine if preview datasets should be shown */ - private static final BooleanProperty SHOW_PREVIEW = new BooleanProperty("mapwithai.sources.preview", false); + public static final BooleanProperty SHOW_PREVIEW = new BooleanProperty("mapwithai.sources.preview", false); /** List of all usable layers */ private final List layers = Collections.synchronizedList(new ArrayList<>()); @@ -500,7 +501,7 @@ public class MapWithAILayerInfo { * {@code true}. */ private static List filterPreview(List layers) { - if (SHOW_PREVIEW.get()) { + if (Boolean.TRUE.equals(SHOW_PREVIEW.get()) && ExpertToggleAction.isExpert()) { return layers; } return layers.stream() diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/MapWithAIPreferences.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/MapWithAIPreferences.java index cd9ebe7..606f3e0 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/MapWithAIPreferences.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/MapWithAIPreferences.java @@ -129,7 +129,7 @@ public class MapWithAIPreferences extends DefaultTabPreferenceSetting { pane.add(expertHorizontalGlue, GBC.eol().fill(GridBagConstraints.HORIZONTAL)); final JLabel previewFeatureSets = new JLabel(tr("Show Preview DataSets")); final JCheckBox previewFeatureSetCheckbox = new JCheckBox(); - BooleanProperty previewFeatureSetProperty = new BooleanProperty("mapwithai.sources.preview", false); + BooleanProperty previewFeatureSetProperty = MapWithAILayerInfo.SHOW_PREVIEW; previewFeatureSetCheckbox.setToolTipText(tr("If selected, show datasets which may have various issues")); previewFeatureSetCheckbox.setSelected(Boolean.TRUE.equals(previewFeatureSetProperty.get())); previewFeatureSetCheckbox