Skip to content

Commit

Permalink
Fix shortcuts
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Dec 17, 2024
1 parent c8e6da9 commit b6434b1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>org.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>0.22.0</version>
<version>0.24.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,26 @@ 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
*
* @param type The type of object we are ignoring
*/
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;
}

Expand All @@ -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;
Expand Down

0 comments on commit b6434b1

Please sign in to comment.