diff options
author | Matthias Becker | 2019-04-12 10:44:35 +0000 |
---|---|---|
committer | Matthias Becker | 2019-04-12 10:44:35 +0000 |
commit | 54cac7b35fcbea386f5fa253d5cf644e39769bf7 (patch) | |
tree | 0179149b296d4073468547d4d7c7d142550480f1 /bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java | |
parent | 8b7f8eff01f0b05f7887ef4c964722bfecd62c84 (diff) | |
download | eclipse.platform.ui-54cac7b35fcbea386f5fa253d5cf644e39769bf7.tar.gz eclipse.platform.ui-54cac7b35fcbea386f5fa253d5cf644e39769bf7.tar.xz eclipse.platform.ui-54cac7b35fcbea386f5fa253d5cf644e39769bf7.zip |
Bug 546220: Only use Tabs for indentation
This change only contains whitespace changes performed by the
JDT formatter. No manual changes are contained.
Change-Id: Iaca17909713341fc945eb180cc733b66211e1a13
Signed-off-by: Matthias Becker <ma.becker@sap.com>
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java')
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java | 699 |
1 files changed, 340 insertions, 359 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java index a438df01aa9..c2f1ea5d243 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java @@ -31,310 +31,297 @@ import org.eclipse.ui.internal.keys.NativeKeyFormatter; @Deprecated public final class SWTKeySupport { - /** - * Given an SWT accelerator value, provide the corresponding key stroke. - * - * @param accelerator - * The accelerator to convert; should be a valid SWT accelerator - * value. - * @return The equivalent key stroke; never <code>null</code>. - */ - public static KeyStroke convertAcceleratorToKeyStroke(int accelerator) { - final SortedSet modifierKeys = new TreeSet(); + /** + * Given an SWT accelerator value, provide the corresponding key stroke. + * + * @param accelerator The accelerator to convert; should be a valid SWT + * accelerator value. + * @return The equivalent key stroke; never <code>null</code>. + */ + public static KeyStroke convertAcceleratorToKeyStroke(int accelerator) { + final SortedSet modifierKeys = new TreeSet(); NaturalKey naturalKey; - if ((accelerator & SWT.ALT) != 0) { + if ((accelerator & SWT.ALT) != 0) { modifierKeys.add(ModifierKey.ALT); } - if ((accelerator & SWT.COMMAND) != 0) { + if ((accelerator & SWT.COMMAND) != 0) { modifierKeys.add(ModifierKey.COMMAND); } - if ((accelerator & SWT.CTRL) != 0) { + if ((accelerator & SWT.CTRL) != 0) { modifierKeys.add(ModifierKey.CTRL); } - if ((accelerator & SWT.SHIFT) != 0) { + if ((accelerator & SWT.SHIFT) != 0) { modifierKeys.add(ModifierKey.SHIFT); } - if (((accelerator & SWT.KEY_MASK) == 0) && (accelerator != 0)) { - // There were only accelerators - naturalKey = null; - } else { - // There were other keys. - accelerator &= SWT.KEY_MASK; - - switch (accelerator) { - case SWT.ARROW_DOWN: - naturalKey = SpecialKey.ARROW_DOWN; - break; - case SWT.ARROW_LEFT: - naturalKey = SpecialKey.ARROW_LEFT; - break; - case SWT.ARROW_RIGHT: - naturalKey = SpecialKey.ARROW_RIGHT; - break; - case SWT.ARROW_UP: - naturalKey = SpecialKey.ARROW_UP; - break; - case SWT.BREAK: - naturalKey = SpecialKey.BREAK; - break; - case SWT.CAPS_LOCK: - naturalKey = SpecialKey.CAPS_LOCK; - break; - case SWT.END: - naturalKey = SpecialKey.END; - break; - case SWT.F1: - naturalKey = SpecialKey.F1; - break; - case SWT.F10: - naturalKey = SpecialKey.F10; - break; - case SWT.F11: - naturalKey = SpecialKey.F11; - break; - case SWT.F12: - naturalKey = SpecialKey.F12; - break; - case SWT.F2: - naturalKey = SpecialKey.F2; - break; - case SWT.F3: - naturalKey = SpecialKey.F3; - break; - case SWT.F4: - naturalKey = SpecialKey.F4; - break; - case SWT.F5: - naturalKey = SpecialKey.F5; - break; - case SWT.F6: - naturalKey = SpecialKey.F6; - break; - case SWT.F7: - naturalKey = SpecialKey.F7; - break; - case SWT.F8: - naturalKey = SpecialKey.F8; - break; - case SWT.F9: - naturalKey = SpecialKey.F9; - break; - case SWT.HOME: - naturalKey = SpecialKey.HOME; - break; - case SWT.INSERT: - naturalKey = SpecialKey.INSERT; - break; - case SWT.KEYPAD_0: - naturalKey = SpecialKey.NUMPAD_0; - break; - case SWT.KEYPAD_1: - naturalKey = SpecialKey.NUMPAD_1; - break; - case SWT.KEYPAD_2: - naturalKey = SpecialKey.NUMPAD_2; - break; - case SWT.KEYPAD_3: - naturalKey = SpecialKey.NUMPAD_3; - break; - case SWT.KEYPAD_4: - naturalKey = SpecialKey.NUMPAD_4; - break; - case SWT.KEYPAD_5: - naturalKey = SpecialKey.NUMPAD_5; - break; - case SWT.KEYPAD_6: - naturalKey = SpecialKey.NUMPAD_6; - break; - case SWT.KEYPAD_7: - naturalKey = SpecialKey.NUMPAD_7; - break; - case SWT.KEYPAD_8: - naturalKey = SpecialKey.NUMPAD_8; - break; - case SWT.KEYPAD_9: - naturalKey = SpecialKey.NUMPAD_9; - break; - case SWT.KEYPAD_ADD: - naturalKey = SpecialKey.NUMPAD_ADD; - break; - case SWT.KEYPAD_CR: - naturalKey = SpecialKey.NUMPAD_ENTER; - break; - case SWT.KEYPAD_DECIMAL: - naturalKey = SpecialKey.NUMPAD_DECIMAL; - break; - case SWT.KEYPAD_DIVIDE: - naturalKey = SpecialKey.NUMPAD_DIVIDE; - break; - case SWT.KEYPAD_EQUAL: - naturalKey = SpecialKey.NUMPAD_EQUAL; - break; - case SWT.KEYPAD_MULTIPLY: - naturalKey = SpecialKey.NUMPAD_MULTIPLY; - break; - case SWT.KEYPAD_SUBTRACT: - naturalKey = SpecialKey.NUMPAD_SUBTRACT; - break; - case SWT.NUM_LOCK: - naturalKey = SpecialKey.NUM_LOCK; - break; - case SWT.PAGE_DOWN: - naturalKey = SpecialKey.PAGE_DOWN; - break; - case SWT.PAGE_UP: - naturalKey = SpecialKey.PAGE_UP; - break; - case SWT.PAUSE: - naturalKey = SpecialKey.PAUSE; - break; - case SWT.PRINT_SCREEN: - naturalKey = SpecialKey.PRINT_SCREEN; - break; - case SWT.SCROLL_LOCK: - naturalKey = SpecialKey.SCROLL_LOCK; - break; - default: - naturalKey = CharacterKey - .getInstance((char) (accelerator & 0xFFFF)); - } - } - - return KeyStroke.getInstance(modifierKeys, naturalKey); - } - - /** - * <p> - * Converts the given event into an SWT accelerator value -- considering the - * modified character with the shift modifier. This is the third accelerator - * value that should be checked. - * </p> - * <p> - * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as - * "Ctrl+Shift+%". - * </p> - * - * @param event - * The event to be converted; must not be <code>null</code>. - * @return The combination of the state mask and the unmodified character. - */ - public static int convertEventToModifiedAccelerator(Event event) { - int modifiers = event.stateMask & SWT.MODIFIER_MASK; - char character = topKey(event); - return modifiers + toUpperCase(character); - } - - /** - * <p> - * Converts the given event into an SWT accelerator value -- considering the - * unmodified character with all modifier keys. This is the first - * accelerator value that should be checked. However, all alphabetic - * characters are considered as their uppercase equivalents. - * </p> - * <p> - * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as - * "Ctrl+Shift+5". - * </p> - * - * @param event - * The event to be converted; must not be <code>null</code>. - * @return The combination of the state mask and the unmodified character. - */ - public static int convertEventToUnmodifiedAccelerator(Event event) { - return convertEventToUnmodifiedAccelerator(event.stateMask, - event.keyCode); - } - - /** - * <p> - * Converts the given state mask and key code into an SWT accelerator value -- - * considering the unmodified character with all modifier keys. All - * alphabetic characters are considered as their uppercase equivalents. - * </p> - * <p> - * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as - * "Ctrl+Shift+5". - * </p> - * - * @param stateMask - * The integer mask of modifiers keys depressed when this was - * pressed. - * @param keyCode - * The key that was pressed, before being modified. - * @return The combination of the state mask and the unmodified character. - */ - private static int convertEventToUnmodifiedAccelerator(int stateMask, - int keyCode) { - int modifiers = stateMask & SWT.MODIFIER_MASK; - int character = keyCode; - return modifiers + toUpperCase(character); - } - - /** - * <p> - * Converts the given event into an SWT accelerator value -- considering the - * unmodified character with all modifier keys. This is the first - * accelerator value that should be checked. However, all alphabetic - * characters are considered as their uppercase equivalents. - * </p> - * <p> - * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as - * "Ctrl+%". - * </p> - * - * @param event - * The event to be converted; must not be <code>null</code>. - * @return The combination of the state mask and the unmodified character. - */ - public static int convertEventToUnmodifiedAccelerator(KeyEvent event) { - return convertEventToUnmodifiedAccelerator(event.stateMask, - event.keyCode); - } - - /** - * Converts the given event into an SWT accelerator value -- considering - * the modified character without the shift modifier. This is the second - * accelerator value that should be checked. Key strokes with alphabetic - * natural keys are run through <code>convertEventToUnmodifiedAccelerator</code> - * - * @param event - * The event to be converted; must not be <code>null</code>. - * @return The combination of the state mask without shift, and the - * modified character. - */ - public static int convertEventToUnshiftedModifiedAccelerator(Event event) { - // Disregard alphabetic key strokes. - if (Character.isLetter((char) event.keyCode)) { - return convertEventToUnmodifiedAccelerator(event); - } - - int modifiers = event.stateMask & (SWT.MODIFIER_MASK ^ SWT.SHIFT); - char character = topKey(event); - return modifiers + toUpperCase(character); - } - - /** - * Given a key stroke, this method provides the equivalent SWT accelerator - * value. The functional inverse of <code>convertAcceleratorToKeyStroke</code>. - * - * @param keyStroke - * The key stroke to convert; must not be <code>null</code>. - * @return The SWT accelerator value - */ - public static int convertKeyStrokeToAccelerator( - final KeyStroke keyStroke) { - int accelerator = 0; - final Iterator iterator = keyStroke.getModifierKeys().iterator(); - - while (iterator.hasNext()) { - final ModifierKey modifierKey = (ModifierKey) iterator.next(); - - if (modifierKey == ModifierKey.ALT) { + if (((accelerator & SWT.KEY_MASK) == 0) && (accelerator != 0)) { + // There were only accelerators + naturalKey = null; + } else { + // There were other keys. + accelerator &= SWT.KEY_MASK; + + switch (accelerator) { + case SWT.ARROW_DOWN: + naturalKey = SpecialKey.ARROW_DOWN; + break; + case SWT.ARROW_LEFT: + naturalKey = SpecialKey.ARROW_LEFT; + break; + case SWT.ARROW_RIGHT: + naturalKey = SpecialKey.ARROW_RIGHT; + break; + case SWT.ARROW_UP: + naturalKey = SpecialKey.ARROW_UP; + break; + case SWT.BREAK: + naturalKey = SpecialKey.BREAK; + break; + case SWT.CAPS_LOCK: + naturalKey = SpecialKey.CAPS_LOCK; + break; + case SWT.END: + naturalKey = SpecialKey.END; + break; + case SWT.F1: + naturalKey = SpecialKey.F1; + break; + case SWT.F10: + naturalKey = SpecialKey.F10; + break; + case SWT.F11: + naturalKey = SpecialKey.F11; + break; + case SWT.F12: + naturalKey = SpecialKey.F12; + break; + case SWT.F2: + naturalKey = SpecialKey.F2; + break; + case SWT.F3: + naturalKey = SpecialKey.F3; + break; + case SWT.F4: + naturalKey = SpecialKey.F4; + break; + case SWT.F5: + naturalKey = SpecialKey.F5; + break; + case SWT.F6: + naturalKey = SpecialKey.F6; + break; + case SWT.F7: + naturalKey = SpecialKey.F7; + break; + case SWT.F8: + naturalKey = SpecialKey.F8; + break; + case SWT.F9: + naturalKey = SpecialKey.F9; + break; + case SWT.HOME: + naturalKey = SpecialKey.HOME; + break; + case SWT.INSERT: + naturalKey = SpecialKey.INSERT; + break; + case SWT.KEYPAD_0: + naturalKey = SpecialKey.NUMPAD_0; + break; + case SWT.KEYPAD_1: + naturalKey = SpecialKey.NUMPAD_1; + break; + case SWT.KEYPAD_2: + naturalKey = SpecialKey.NUMPAD_2; + break; + case SWT.KEYPAD_3: + naturalKey = SpecialKey.NUMPAD_3; + break; + case SWT.KEYPAD_4: + naturalKey = SpecialKey.NUMPAD_4; + break; + case SWT.KEYPAD_5: + naturalKey = SpecialKey.NUMPAD_5; + break; + case SWT.KEYPAD_6: + naturalKey = SpecialKey.NUMPAD_6; + break; + case SWT.KEYPAD_7: + naturalKey = SpecialKey.NUMPAD_7; + break; + case SWT.KEYPAD_8: + naturalKey = SpecialKey.NUMPAD_8; + break; + case SWT.KEYPAD_9: + naturalKey = SpecialKey.NUMPAD_9; + break; + case SWT.KEYPAD_ADD: + naturalKey = SpecialKey.NUMPAD_ADD; + break; + case SWT.KEYPAD_CR: + naturalKey = SpecialKey.NUMPAD_ENTER; + break; + case SWT.KEYPAD_DECIMAL: + naturalKey = SpecialKey.NUMPAD_DECIMAL; + break; + case SWT.KEYPAD_DIVIDE: + naturalKey = SpecialKey.NUMPAD_DIVIDE; + break; + case SWT.KEYPAD_EQUAL: + naturalKey = SpecialKey.NUMPAD_EQUAL; + break; + case SWT.KEYPAD_MULTIPLY: + naturalKey = SpecialKey.NUMPAD_MULTIPLY; + break; + case SWT.KEYPAD_SUBTRACT: + naturalKey = SpecialKey.NUMPAD_SUBTRACT; + break; + case SWT.NUM_LOCK: + naturalKey = SpecialKey.NUM_LOCK; + break; + case SWT.PAGE_DOWN: + naturalKey = SpecialKey.PAGE_DOWN; + break; + case SWT.PAGE_UP: + naturalKey = SpecialKey.PAGE_UP; + break; + case SWT.PAUSE: + naturalKey = SpecialKey.PAUSE; + break; + case SWT.PRINT_SCREEN: + naturalKey = SpecialKey.PRINT_SCREEN; + break; + case SWT.SCROLL_LOCK: + naturalKey = SpecialKey.SCROLL_LOCK; + break; + default: + naturalKey = CharacterKey.getInstance((char) (accelerator & 0xFFFF)); + } + } + + return KeyStroke.getInstance(modifierKeys, naturalKey); + } + + /** + * <p> + * Converts the given event into an SWT accelerator value -- considering the + * modified character with the shift modifier. This is the third accelerator + * value that should be checked. + * </p> + * <p> + * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as + * "Ctrl+Shift+%". + * </p> + * + * @param event The event to be converted; must not be <code>null</code>. + * @return The combination of the state mask and the unmodified character. + */ + public static int convertEventToModifiedAccelerator(Event event) { + int modifiers = event.stateMask & SWT.MODIFIER_MASK; + char character = topKey(event); + return modifiers + toUpperCase(character); + } + + /** + * <p> + * Converts the given event into an SWT accelerator value -- considering the + * unmodified character with all modifier keys. This is the first accelerator + * value that should be checked. However, all alphabetic characters are + * considered as their uppercase equivalents. + * </p> + * <p> + * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as + * "Ctrl+Shift+5". + * </p> + * + * @param event The event to be converted; must not be <code>null</code>. + * @return The combination of the state mask and the unmodified character. + */ + public static int convertEventToUnmodifiedAccelerator(Event event) { + return convertEventToUnmodifiedAccelerator(event.stateMask, event.keyCode); + } + + /** + * <p> + * Converts the given state mask and key code into an SWT accelerator value -- + * considering the unmodified character with all modifier keys. All alphabetic + * characters are considered as their uppercase equivalents. + * </p> + * <p> + * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as + * "Ctrl+Shift+5". + * </p> + * + * @param stateMask The integer mask of modifiers keys depressed when this was + * pressed. + * @param keyCode The key that was pressed, before being modified. + * @return The combination of the state mask and the unmodified character. + */ + private static int convertEventToUnmodifiedAccelerator(int stateMask, int keyCode) { + int modifiers = stateMask & SWT.MODIFIER_MASK; + int character = keyCode; + return modifiers + toUpperCase(character); + } + + /** + * <p> + * Converts the given event into an SWT accelerator value -- considering the + * unmodified character with all modifier keys. This is the first accelerator + * value that should be checked. However, all alphabetic characters are + * considered as their uppercase equivalents. + * </p> + * <p> + * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as + * "Ctrl+%". + * </p> + * + * @param event The event to be converted; must not be <code>null</code>. + * @return The combination of the state mask and the unmodified character. + */ + public static int convertEventToUnmodifiedAccelerator(KeyEvent event) { + return convertEventToUnmodifiedAccelerator(event.stateMask, event.keyCode); + } + + /** + * Converts the given event into an SWT accelerator value -- considering the + * modified character without the shift modifier. This is the second accelerator + * value that should be checked. Key strokes with alphabetic natural keys are + * run through <code>convertEventToUnmodifiedAccelerator</code> + * + * @param event The event to be converted; must not be <code>null</code>. + * @return The combination of the state mask without shift, and the modified + * character. + */ + public static int convertEventToUnshiftedModifiedAccelerator(Event event) { + // Disregard alphabetic key strokes. + if (Character.isLetter((char) event.keyCode)) { + return convertEventToUnmodifiedAccelerator(event); + } + + int modifiers = event.stateMask & (SWT.MODIFIER_MASK ^ SWT.SHIFT); + char character = topKey(event); + return modifiers + toUpperCase(character); + } + + /** + * Given a key stroke, this method provides the equivalent SWT accelerator + * value. The functional inverse of <code>convertAcceleratorToKeyStroke</code>. + * + * @param keyStroke The key stroke to convert; must not be <code>null</code>. + * @return The SWT accelerator value + */ + public static int convertKeyStrokeToAccelerator(final KeyStroke keyStroke) { + int accelerator = 0; + final Iterator iterator = keyStroke.getModifierKeys().iterator(); + + while (iterator.hasNext()) { + final ModifierKey modifierKey = (ModifierKey) iterator.next(); + + if (modifierKey == ModifierKey.ALT) { accelerator |= SWT.ALT; } else if (modifierKey == ModifierKey.COMMAND) { accelerator |= SWT.COMMAND; @@ -343,16 +330,16 @@ public final class SWTKeySupport { } else if (modifierKey == ModifierKey.SHIFT) { accelerator |= SWT.SHIFT; } - } + } - final NaturalKey naturalKey = keyStroke.getNaturalKey(); + final NaturalKey naturalKey = keyStroke.getNaturalKey(); - if (naturalKey instanceof CharacterKey) { + if (naturalKey instanceof CharacterKey) { accelerator |= ((CharacterKey) naturalKey).getCharacter(); } else if (naturalKey instanceof SpecialKey) { - final SpecialKey specialKey = (SpecialKey) naturalKey; + final SpecialKey specialKey = (SpecialKey) naturalKey; - if (specialKey == SpecialKey.ARROW_DOWN) { + if (specialKey == SpecialKey.ARROW_DOWN) { accelerator |= SWT.ARROW_DOWN; } else if (specialKey == SpecialKey.ARROW_LEFT) { accelerator |= SWT.ARROW_LEFT; @@ -395,71 +382,65 @@ public final class SWTKeySupport { } else if (specialKey == SpecialKey.PAGE_UP) { accelerator |= SWT.PAGE_UP; } - } - - return accelerator; - } - - private static final IKeyFormatter NATIVE_FORMATTER = new NativeKeyFormatter(); - - /** - * Provides an instance of <code>IKeyFormatter</code> appropriate for the - * current instance. - * - * @return an instance of <code>IKeyFormatter</code> appropriate for the - * current instance; never <code>null</code>. - */ - public static IKeyFormatter getKeyFormatterForPlatform() { - return NATIVE_FORMATTER; - } - - /** - * Makes sure that a fully-modified character is converted to the normal - * form. This means that "Ctrl+" key strokes must reverse the modification - * caused by control-escaping. Also, all lower case letters are converted - * to uppercase. - * - * @param event - * The event from which the fully-modified character should be - * pulled. - * @return The modified character, uppercase and without control-escaping. - */ - private static char topKey(Event event) { - char character = event.character; - boolean ctrlDown = (event.stateMask & SWT.CTRL) != 0; - - if (ctrlDown && event.character != event.keyCode - && event.character < 0x20) { + } + + return accelerator; + } + + private static final IKeyFormatter NATIVE_FORMATTER = new NativeKeyFormatter(); + + /** + * Provides an instance of <code>IKeyFormatter</code> appropriate for the + * current instance. + * + * @return an instance of <code>IKeyFormatter</code> appropriate for the current + * instance; never <code>null</code>. + */ + public static IKeyFormatter getKeyFormatterForPlatform() { + return NATIVE_FORMATTER; + } + + /** + * Makes sure that a fully-modified character is converted to the normal form. + * This means that "Ctrl+" key strokes must reverse the modification caused by + * control-escaping. Also, all lower case letters are converted to uppercase. + * + * @param event The event from which the fully-modified character should be + * pulled. + * @return The modified character, uppercase and without control-escaping. + */ + private static char topKey(Event event) { + char character = event.character; + boolean ctrlDown = (event.stateMask & SWT.CTRL) != 0; + + if (ctrlDown && event.character != event.keyCode && event.character < 0x20) { character += 0x40; } - return character; - } - - /** - * Makes the given character uppercase if it is a letter. - * - * @param keyCode - * The character to convert. - * @return The uppercase equivalent, if any; otherwise, the character - * itself. - */ - private static int toUpperCase(int keyCode) { - // Will this key code be truncated? - if (keyCode > 0xFFFF) { - return keyCode; - } - - // Downcast in safety. Only make characters uppercase. - char character = (char) keyCode; - return Character.isLetter(character) ? Character.toUpperCase(character) - : keyCode; - } - - /** - * This class should never be instantiated. - */ - private SWTKeySupport() { - // This class should never be instantiated. - } + return character; + } + + /** + * Makes the given character uppercase if it is a letter. + * + * @param keyCode The character to convert. + * @return The uppercase equivalent, if any; otherwise, the character itself. + */ + private static int toUpperCase(int keyCode) { + // Will this key code be truncated? + if (keyCode > 0xFFFF) { + return keyCode; + } + + // Downcast in safety. Only make characters uppercase. + char character = (char) keyCode; + return Character.isLetter(character) ? Character.toUpperCase(character) : keyCode; + } + + /** + * This class should never be instantiated. + */ + private SWTKeySupport() { + // This class should never be instantiated. + } } |