Return the correct KeyStroke per locale and platform. Also checks for any additional overrides in preferences.txt. @param base the localization key for the menu item (.keystroke and .platform will be added to the end) @return KeyStroke for base + .keystroke + .platform (or the va
(String base)
| 128 | * (or the value from preferences) or null if none found |
| 129 | */ |
| 130 | static public KeyStroke getKeyStrokeExt(String base) { |
| 131 | String key = base + ".keystroke"; |
| 132 | |
| 133 | // see if there's an override in preferences.txt |
| 134 | String sequence = Preferences.get(key); |
| 135 | if (sequence != null) { |
| 136 | KeyStroke ks = KeyStroke.getKeyStroke(sequence); |
| 137 | if (ks != null) { |
| 138 | return ks; // user did good, we're all set |
| 139 | |
| 140 | } else { |
| 141 | System.err.format(BAD_KEYSTROKE, sequence); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | sequence = Language.text(key + "." + Platform.getName()); |
| 146 | KeyStroke ks = KeyStroke.getKeyStroke(sequence); |
| 147 | if (ks == null) { |
| 148 | // this can only happen if user has screwed up their language files |
| 149 | System.err.format(BAD_KEYSTROKE, sequence); |
| 150 | //return KeyStroke.getKeyStroke(0, 0); // badness |
| 151 | } |
| 152 | return ks; |
| 153 | } |
| 154 | |
| 155 | |
| 156 | /** |
no test coverage detected