diff --git a/pom.xml b/pom.xml index 3786aa9..34e0568 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ org.commonmark commonmark - 0.22.0 + 0.24.0 compile diff --git a/src/main/java/org/openstreetmap/josm/plugins/maproulette/actions/IgnoreAction.java b/src/main/java/org/openstreetmap/josm/plugins/maproulette/actions/IgnoreAction.java index 09dbd07..0d17ea3 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/maproulette/actions/IgnoreAction.java +++ b/src/main/java/org/openstreetmap/josm/plugins/maproulette/actions/IgnoreAction.java @@ -31,6 +31,18 @@ public class IgnoreAction extends JosmAction { */ private final IgnoreType type; + /** + * Generate shortcuts in a manner friendly for the ShortcutsList + * @param type The type + * @return The shortcut + */ + private static Shortcut generateShortcut(IgnoreType type) { + return switch (type) { + case IGNORE_TASK -> Shortcut.registerShortcut("maproulette:ignore.ignore_task", tr("MapRoulette: Ignore Task"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE); + case IGNORE_CHALLENGE -> Shortcut.registerShortcut("maproulette:ignore.ignore_challenge", tr("MapRoulette: Ignore Challenge"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE); + }; + } + /** * Create a new action object * @@ -38,10 +50,7 @@ public class IgnoreAction extends JosmAction { */ public IgnoreAction(IgnoreType type) { super(tr(type.getButtonText()), "dialogs/fix", tr(type.getButtonText()), - Shortcut.registerShortcut( - /* NO-SHORTCUT */ "maproulette:ignore." + type.name().toLowerCase(Locale.ROOT), - tr("MapRoulette: {0}", tr(type.getButtonText())), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), - false); + generateShortcut(type), false); this.type = type; } @@ -68,9 +77,7 @@ public void actionPerformed(ActionEvent e) { * The ignore type */ public enum IgnoreType { - /* SHORTCUT(MapRoulette: Ignore Task, maproulette:ignore.task, NONE, UNDEFINED) */ IGNORE_TASK(marktr("Ignore Task")), - /* SHORTCUT(MapRoulette: Ignore Challenge, maproulette:ignore.challenge, NONE, UNDEFINED) */ IGNORE_CHALLENGE(marktr("Ignore Challenge")); private final String buttonText;