source: josm/trunk/src/org/openstreetmap/josm/gui/util/MultikeyShortcutAction.java@ 13146

Last change on this file since 13146 was 12807, checked in by Don-vip, 7 years ago

see #15229 - see #15182 - see #14794 - checkstyle, unit tests

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.util;
3
4import java.util.List;
5
6import javax.swing.Action;
7
8import org.openstreetmap.josm.tools.Shortcut;
9
10/**
11 * Action implementing a multikey shortcut - shorcuts like Ctrl+Alt+S,n will toggle n-th layer visibility.
12 * @since 4595
13 */
14public interface MultikeyShortcutAction extends Action {
15
16 class MultikeyInfo {
17 private final int index;
18 private final String description;
19
20 public MultikeyInfo(int index, String description) {
21 this.index = index;
22 this.description = description;
23 }
24
25 public int getIndex() {
26 return index;
27 }
28
29 public char getShortcut() {
30 if (index < 9)
31 return (char) ('1' + index);
32 else if (index == 9)
33 return '0';
34 else
35 return (char) ('A' + index - 10);
36 }
37
38 public String getDescription() {
39 return description;
40 }
41 }
42
43 Shortcut getMultikeyShortcut();
44
45 void executeMultikeyAction(int index, boolean repeatLastAction);
46
47 List<MultikeyInfo> getMultikeyCombinations();
48
49 MultikeyInfo getLastMultikeyAction();
50
51}
Note: See TracBrowser for help on using the repository browser.