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.
Modifier and Type | Field and Description |
---|---|
protected static String |
KEY_DELIMITER_KEY
The key for the delimiter between keys.
|
protected static String |
KEY_STROKE_DELIMITER_KEY
The key for the delimiter between key strokes.
|
protected static int[] |
NO_MODIFIER_KEYS
An empty integer array that can be used in
sortModifierKeys(int) . |
Constructor and Description |
---|
AbstractKeyFormatter() |
Modifier and Type | Method and Description |
---|---|
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.
|
protected static final String KEY_DELIMITER_KEY
protected static final String KEY_STROKE_DELIMITER_KEY
protected static final int[] NO_MODIFIER_KEYS
sortModifierKeys(int)
.public String format(int key)
IKeyFormatter
format
in interface IKeyFormatter
key
- The key to format.null
.public String format(KeySequence keySequence)
IKeyFormatter
format
in interface IKeyFormatter
keySequence
- The key sequence to convert; must not be null
.null
.public String format(KeyStroke keyStroke)
IKeyFormatter
format
in interface IKeyFormatter
keyStroke
- The key stroke to convert; must not be null
.
null
protected abstract String getKeyDelimiter()
null
.protected abstract String getKeyStrokeDelimiter()
null
.protected abstract int[] sortModifierKeys(int modifierKeys)
modifierKeys
- The modifier keys from the key stroke.KeyStroke.NO_KEY
should be ignored.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.