Class NativeKeyFormatter
- java.lang.Object
-
- org.eclipse.jface.bindings.keys.formatting.AbstractKeyFormatter
-
- org.eclipse.jface.bindings.keys.formatting.NativeKeyFormatter
-
- All Implemented Interfaces:
IKeyFormatter
public final class NativeKeyFormatter extends AbstractKeyFormatter
Formats the key sequences and key strokes into the native human-readable format. This is typically what you would see on the menus for the given platform and locale.
- Since:
- 3.1
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.bindings.keys.formatting.AbstractKeyFormatter
KEY_DELIMITER_KEY, KEY_STROKE_DELIMITER_KEY, NO_MODIFIER_KEYS
-
-
Constructor Summary
Constructors Constructor Description NativeKeyFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(int key)Formats an individual key into a human readable format.protected StringgetKeyDelimiter()An accessor for the delimiter you wish to use between keys.protected StringgetKeyStrokeDelimiter()An accessor for the delimiter you wish to use between key strokes.protected int[]sortModifierKeys(int modifierKeys)Separates the modifier keys from each other, and then places them in an array in some sorted order.-
Methods inherited from class org.eclipse.jface.bindings.keys.formatting.AbstractKeyFormatter
format, format
-
-
-
-
Method Detail
-
format
public final String format(int key)
Formats an individual key into a human readable format. This uses an internationalization resource bundle to look up the key. This does the platform-specific formatting for Carbon.- Specified by:
formatin interfaceIKeyFormatter- Overrides:
formatin classAbstractKeyFormatter- Parameters:
key- The key to format.- Returns:
- The key formatted as a string; should not be
null.
-
getKeyDelimiter
protected String getKeyDelimiter()
Description copied from class:AbstractKeyFormatterAn accessor for the delimiter you wish to use between keys. This is used by the default format implementations to determine the key delimiter.- Specified by:
getKeyDelimiterin classAbstractKeyFormatter- Returns:
- The delimiter to use between keys; should not be
null.
-
getKeyStrokeDelimiter
protected String getKeyStrokeDelimiter()
Description copied from class:AbstractKeyFormatterAn accessor for the delimiter you wish to use between key strokes. This used by the default format implementations to determine the key stroke delimiter.- Specified by:
getKeyStrokeDelimiterin classAbstractKeyFormatter- Returns:
- The delimiter to use between key strokes; should not be
null.
-
sortModifierKeys
protected int[] sortModifierKeys(int modifierKeys)
Description copied from class:AbstractKeyFormatterSeparates the modifier keys from each other, and then places them in an array in some sorted order. The sort order is dependent on the type of formatter.- Specified by:
sortModifierKeysin classAbstractKeyFormatter- Parameters:
modifierKeys- The modifier keys from the key stroke.- Returns:
- An array of modifier key values -- separated and sorted in some
order. Any values in this array that are
KeyStroke.NO_KEYshould be ignored.
-
-