public final class KeySequenceText extends Object
A wrapper around the SWT text widget that traps literal key presses and converts them into key sequences for display. There are two types of key strokes that are displayed: complete and incomplete. A complete key stroke is one with a natural key, while an incomplete one has no natural key. Incomplete key strokes are only displayed until they are made complete or their component key presses are released.
Modifier and Type | Field and Description |
---|---|
static int |
INFINITE
The special integer value for the maximum number of strokes indicating
that an infinite number should be allowed.
|
static String |
P_KEY_SEQUENCE
The name of the property representing the current key sequence in this
key sequence widget.
|
static List |
TRAPPED_KEYS
The keys trapped by this widget.
|
Constructor and Description |
---|
KeySequenceText(Text wrappedText)
Constructs an instance of
KeySequenceTextField with the
text field to use. |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(IPropertyChangeListener listener)
Adds a property change listener to this key sequence widget.
|
void |
clear()
Clears the text field and resets all the internal values.
|
protected void |
firePropertyChangeEvent(KeySequence oldKeySequence)
Fires a property change event to all of the listeners.
|
KeySequence |
getKeySequence()
An accessor for the
KeySequence that corresponds to the
current state of the text field. |
int |
getKeyStrokeLimit()
Returns the maximum number of strokes that are permitted in this widget
at one time.
|
void |
insert(KeyStroke stroke)
Inserts the key stroke at the current insertion point.
|
void |
removePropertyChangeListener(IPropertyChangeListener listener)
Removes the given listener from this key sequence widget.
|
void |
setKeySequence(KeySequence newKeySequence)
A mutator for the key sequence stored within this widget.
|
void |
setKeyStrokeLimit(int keyStrokeLimit)
A mutator for the maximum number of strokes that are permitted in this
widget at one time.
|
public static final int INFINITE
public static final String P_KEY_SEQUENCE
public static final List TRAPPED_KEYS
public KeySequenceText(Text wrappedText)
KeySequenceTextField
with the
text field to use. If the platform is carbon (MacOS X), then the font is
set to be the same font used to display accelerators in the menus.wrappedText
- The text widget to wrap; must not be null
.public final void addPropertyChangeListener(IPropertyChangeListener listener)
listener
- The listener to be notified when changes occur; must not be
null
.public void clear()
protected final void firePropertyChangeEvent(KeySequence oldKeySequence)
oldKeySequence
- The old key sequence; must not be null
.public KeySequence getKeySequence()
KeySequence
that corresponds to the
current state of the text field. This includes incomplete strokes.null
.public void insert(KeyStroke stroke)
stroke
- The key stroke to insert; must not be null
.public final void removePropertyChangeListener(IPropertyChangeListener listener)
listener
- The listener to be removed; must not be null
.public void setKeySequence(KeySequence newKeySequence)
A mutator for the key sequence stored within this widget. The text and caret position are updated.
All sequences are limited to maxStrokes number of strokes in length. If there are already that number of strokes, then it does not show incomplete strokes, and does not keep track of them.
newKeySequence
- The new key sequence for this widget; may be null
if none.public int getKeyStrokeLimit()
INFINITE
.public void setKeyStrokeLimit(int keyStrokeLimit)
keyStrokeLimit
- The maximum number of strokes; must be a positive integer or
INFINITE
.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.