Skip to content

Commit b6434b1

Browse files
committed
Fix shortcuts
Signed-off-by: Taylor Smock <[email protected]>
1 parent c8e6da9 commit b6434b1

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>org.commonmark</groupId>
2020
<artifactId>commonmark</artifactId>
21-
<version>0.22.0</version>
21+
<version>0.24.0</version>
2222
<scope>compile</scope>
2323
</dependency>
2424
</dependencies>

src/main/java/org/openstreetmap/josm/plugins/maproulette/actions/IgnoreAction.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,26 @@ public class IgnoreAction extends JosmAction {
3131
*/
3232
private final IgnoreType type;
3333

34+
/**
35+
* Generate shortcuts in a manner friendly for the ShortcutsList
36+
* @param type The type
37+
* @return The shortcut
38+
*/
39+
private static Shortcut generateShortcut(IgnoreType type) {
40+
return switch (type) {
41+
case IGNORE_TASK -> Shortcut.registerShortcut("maproulette:ignore.ignore_task", tr("MapRoulette: Ignore Task"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE);
42+
case IGNORE_CHALLENGE -> Shortcut.registerShortcut("maproulette:ignore.ignore_challenge", tr("MapRoulette: Ignore Challenge"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE);
43+
};
44+
}
45+
3446
/**
3547
* Create a new action object
3648
*
3749
* @param type The type of object we are ignoring
3850
*/
3951
public IgnoreAction(IgnoreType type) {
4052
super(tr(type.getButtonText()), "dialogs/fix", tr(type.getButtonText()),
41-
Shortcut.registerShortcut(
42-
/* NO-SHORTCUT */ "maproulette:ignore." + type.name().toLowerCase(Locale.ROOT),
43-
tr("MapRoulette: {0}", tr(type.getButtonText())), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
44-
false);
53+
generateShortcut(type), false);
4554
this.type = type;
4655
}
4756

@@ -68,9 +77,7 @@ public void actionPerformed(ActionEvent e) {
6877
* The ignore type
6978
*/
7079
public enum IgnoreType {
71-
/* SHORTCUT(MapRoulette: Ignore Task, maproulette:ignore.task, NONE, UNDEFINED) */
7280
IGNORE_TASK(marktr("Ignore Task")),
73-
/* SHORTCUT(MapRoulette: Ignore Challenge, maproulette:ignore.challenge, NONE, UNDEFINED) */
7481
IGNORE_CHALLENGE(marktr("Ignore Challenge"));
7582

7683
private final String buttonText;

0 commit comments

Comments
 (0)