org.eclipse.jface.bindings.keys.formatting
Class AbstractKeyFormatter
java.lang.Object
org.eclipse.jface.bindings.keys.formatting.AbstractKeyFormatter
-
All Implemented Interfaces:
-
IKeyFormatter
-
Direct Known Subclasses:
-
EmacsKeyFormatter,
FormalKeyFormatter,
NativeKeyFormatter
-
public abstract class AbstractKeyFormatter
- extends
Object
- implements
IKeyFormatter
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
Method Summary
|
String
|
format
(int key)
Formats an individual key into a human readable format. |
String
|
format
(
KeySequence keySequence)
Format the given key sequence into a string. |
String
|
format
(
KeyStroke keyStroke)
Format the given key strokes into a string. |
protected abstract
String
|
getKeyDelimiter
()
An accessor for the delimiter you wish to use between keys. |
protected abstract
String
|
getKeyStrokeDelimiter
()
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. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
KEY_DELIMITER_KEY
protected static final
String KEY_DELIMITER_KEY
- The key for the delimiter between keys. This is used in the
internationalization bundles.
-
See Also:
-
Constant Field Values
KEY_STROKE_DELIMITER_KEY
protected static final
String KEY_STROKE_DELIMITER_KEY
- The key for the delimiter between key strokes. This is used in the
internationalization bundles.
-
See Also:
-
Constant Field Values
NO_MODIFIER_KEYS
protected static final int[] NO_MODIFIER_KEYS
- An empty integer array that can be used in
sortModifierKeys(int)
.
AbstractKeyFormatter
public AbstractKeyFormatter()
format
public
String format(int key)
-
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 interface
IKeyFormatter
-
-
Parameters:
-
key
- The key to format.
-
Returns:
- The key formatted as a string; should not be
null
.
format
public
String format(
KeySequence keySequence)
-
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 interface
IKeyFormatter
-
-
Parameters:
-
keySequence
- The key sequence to convert; must not be null
.
-
Returns:
- A string representation of the key sequence; must not be
null
.
format
public
String format(
KeyStroke keyStroke)
-
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 interface
IKeyFormatter
-
-
Parameters:
-
keyStroke
- The key stroke to convert; must not be null
.
-
Returns:
- A string representation of the key stroke; must not be
null
getKeyDelimiter
protected abstract
String 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
protected abstract
String 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.
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.