(String shortcut)
| 1627 | } |
| 1628 | |
| 1629 | public static int convertShortcutToCode(String shortcut) { |
| 1630 | int code = 0; |
| 1631 | int len = shortcut.length(); |
| 1632 | if (len==2 && shortcut.charAt(0)=='F') { |
| 1633 | code = KeyEvent.VK_F1+(int)shortcut.charAt(1)-49; |
| 1634 | if (code>=KeyEvent.VK_F1 && code<=KeyEvent.VK_F9) |
| 1635 | return code; |
| 1636 | else |
| 1637 | return 0; |
| 1638 | } |
| 1639 | if (len==3 && shortcut.charAt(0)=='F') { |
| 1640 | code = KeyEvent.VK_F10+(int)shortcut.charAt(2)-48; |
| 1641 | if (code>=KeyEvent.VK_F10 && code<=KeyEvent.VK_F12) |
| 1642 | return code; |
| 1643 | else |
| 1644 | return 0; |
| 1645 | } |
| 1646 | if (len==2 && shortcut.charAt(0)=='N') { // numeric keypad |
| 1647 | code = KeyEvent.VK_NUMPAD0+(int)shortcut.charAt(1)-48; |
| 1648 | if (code>=KeyEvent.VK_NUMPAD0 && code<=KeyEvent.VK_NUMPAD9) |
| 1649 | return code; |
| 1650 | switch (shortcut.charAt(1)) { |
| 1651 | case '/': return KeyEvent.VK_DIVIDE; |
| 1652 | case '*': return KeyEvent.VK_MULTIPLY; |
| 1653 | case '-': return KeyEvent.VK_SUBTRACT; |
| 1654 | case '+': return KeyEvent.VK_ADD; |
| 1655 | case '.': return KeyEvent.VK_DECIMAL; |
| 1656 | default: return 0; |
| 1657 | } |
| 1658 | } |
| 1659 | if (len!=1) |
| 1660 | return 0; |
| 1661 | int c = (int)shortcut.charAt(0); |
| 1662 | if (c>=65&&c<=90) //A-Z |
| 1663 | code = KeyEvent.VK_A+c-65 + 200; |
| 1664 | else if (c>=97&&c<=122) //a-z |
| 1665 | code = KeyEvent.VK_A+c-97; |
| 1666 | else if (c>=48&&c<=57) //0-9 |
| 1667 | code = KeyEvent.VK_0+c-48; |
| 1668 | return code; |
| 1669 | } |
| 1670 | |
| 1671 | void installStartupMacroSet() { |
| 1672 | if (macrosPath==null) { |
no test coverage detected