Class SWTKeySupport
- java.lang.Object
-
- org.eclipse.jface.bindings.keys.SWTKeySupport
-
public final class SWTKeySupport extends Object
A utility class for converting SWT events into key strokes.
- Since:
- 3.1
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SWTKeySupport()
This class should never be instantiated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static KeyStroke
convertAcceleratorToKeyStroke(int accelerator)
Given an SWT accelerator value, provide the corresponding key stroke.static int
convertEventToModifiedAccelerator(Event event)
Converts the given event into an SWT accelerator value -- considering the modified character with the shift modifier.static int
convertEventToUnmodifiedAccelerator(KeyEvent event)
Converts the given event into an SWT accelerator value -- considering the unmodified character with all modifier keys.static int
convertEventToUnmodifiedAccelerator(Event event)
Converts the given event into an SWT accelerator value -- considering the unmodified character with all modifier keys.static int
convertEventToUnshiftedModifiedAccelerator(Event event)
Converts the given event into an SWT accelerator value -- considering the modified character without the shift modifier.static int
convertKeyStrokeToAccelerator(KeyStroke keyStroke)
Given a key stroke, this method provides the equivalent SWT accelerator value.static IKeyFormatter
getKeyFormatterForPlatform()
Provides an instance ofIKeyFormatter
appropriate for the current instance.
-
-
-
Method Detail
-
convertAcceleratorToKeyStroke
public static final KeyStroke convertAcceleratorToKeyStroke(int accelerator)
Given an SWT accelerator value, provide the corresponding key stroke.- Parameters:
accelerator
- The accelerator to convert; should be a valid SWT accelerator value.- Returns:
- The equivalent key stroke; never
null
.
-
convertEventToModifiedAccelerator
public static final int convertEventToModifiedAccelerator(Event event)
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 when processing incoming key events.
For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as "Ctrl+Shift+%".
- Parameters:
event
- The event to be converted; must not benull
.- Returns:
- The combination of the state mask and the unmodified character.
-
convertEventToUnmodifiedAccelerator
public static final int convertEventToUnmodifiedAccelerator(Event event)
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 when processing incoming key events. However, all alphabetic characters are considered as their uppercase equivalents.
For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as "Ctrl+Shift+5".
- Parameters:
event
- The event to be converted; must not benull
.- Returns:
- The combination of the state mask and the unmodified character.
-
convertEventToUnmodifiedAccelerator
public static final int convertEventToUnmodifiedAccelerator(KeyEvent event)
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.
For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as "Ctrl+%".
- Parameters:
event
- The event to be converted; must not benull
.- Returns:
- The combination of the state mask and the unmodified character.
-
convertEventToUnshiftedModifiedAccelerator
public static final int convertEventToUnshiftedModifiedAccelerator(Event event)
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 when processing incoming key events. Key strokes with alphabetic natural keys are run throughconvertEventToUnmodifiedAccelerator
.- Parameters:
event
- The event to be converted; must not benull
.- Returns:
- The combination of the state mask without shift, and the modified character.
-
convertKeyStrokeToAccelerator
public static final int convertKeyStrokeToAccelerator(KeyStroke keyStroke)
Given a key stroke, this method provides the equivalent SWT accelerator value. The functional inverse ofconvertAcceleratorToKeyStroke
.- Parameters:
keyStroke
- The key stroke to convert; must not benull
.- Returns:
- The SWT accelerator value
-
getKeyFormatterForPlatform
public static IKeyFormatter getKeyFormatterForPlatform()
Provides an instance ofIKeyFormatter
appropriate for the current instance.- Returns:
- an instance of
IKeyFormatter
appropriate for the current instance; nevernull
.
-
-