Class AbstractKeyFormatter
java.lang.Object
org.eclipse.jface.bindings.keys.formatting.AbstractKeyFormatter
- All Implemented Interfaces:
IKeyFormatter
- Direct Known Subclasses:
EmacsKeyFormatter
,FormalKeyFormatter
,NativeKeyFormatter
An abstract implementation of a key formatter that provides a lot of common
key formatting functionality. It is recommended that implementations of
IKeyFormatter
subclass from here, rather than implementing
IKeyFormatter
directly.
- Since:
- 3.1
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionformat
(int key) Formats an individual key into a human readable format.format
(KeySequence keySequence) Format the given key sequence into a string.Format the given key strokes into a string.protected abstract String
An accessor for the delimiter you wish to use between keys.protected abstract String
An accessor for the delimiter you wish to use between key strokes.protected abstract int[]
sortModifierKeys
(int modifierKeys) Separates the modifier keys from each other, and then places them in an array in some sorted order.
-
Field Details
-
KEY_DELIMITER_KEY
The key for the delimiter between keys. This is used in the internationalization bundles.- See Also:
-
KEY_STROKE_DELIMITER_KEY
The key for the delimiter between key strokes. This is used in the internationalization bundles.- See Also:
-
NO_MODIFIER_KEYS
protected static final int[] NO_MODIFIER_KEYSAn empty integer array that can be used insortModifierKeys(int)
.
-
-
Constructor Details
-
AbstractKeyFormatter
public AbstractKeyFormatter()
-
-
Method Details
-
format
Description copied from interface:IKeyFormatter
Formats an individual key into a human readable format. This uses an internationalization resource bundle to look up the key. This does not do any platform-specific formatting (e.g., Carbon's command character).- Specified by:
format
in interfaceIKeyFormatter
- Parameters:
key
- The key to format.- Returns:
- The key formatted as a string; should not be
null
.
-
format
Description copied from interface:IKeyFormatter
Format the given key sequence into a string. The manner of the conversion is dependent on the formatter. It is required that unequal key sequences return unequal strings.- Specified by:
format
in interfaceIKeyFormatter
- Parameters:
keySequence
- The key sequence to convert; must not benull
.- Returns:
- A string representation of the key sequence; must not be
null
.
-
format
Description copied from interface:IKeyFormatter
Format the given key strokes into a string. The manner of the conversion is dependent on the formatter. It is required that unequal key strokes return unequal strings.- Specified by:
format
in interfaceIKeyFormatter
- Parameters:
keyStroke
- The key stroke to convert; must not benull
.- Returns:
- A string representation of the key stroke; must not be
null
-
getKeyDelimiter
An accessor for the delimiter you wish to use between keys. This is used by the default format implementations to determine the key delimiter.- Returns:
- The delimiter to use between keys; should not be
null
.
-
getKeyStrokeDelimiter
An accessor for the delimiter you wish to use between key strokes. This used by the default format implementations to determine the key stroke delimiter.- Returns:
- The delimiter to use between key strokes; should not be
null
.
-
sortModifierKeys
protected abstract int[] sortModifierKeys(int modifierKeys) Separates 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.- 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_KEY
should be ignored.
-