Package org.eclipse.jface.bindings.keys
Class KeySequenceText
java.lang.Object
org.eclipse.jface.bindings.keys.KeySequenceText
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.
- Since:
- 3.1
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe special integer value for the maximum number of strokes indicating that an infinite number should be allowed.static final StringThe name of the property representing the current key sequence in this key sequence widget.static final ListThe keys trapped by this widget.
- 
Constructor SummaryConstructorsConstructorDescriptionKeySequenceText(Text wrappedText) Constructs an instance ofKeySequenceTextFieldwith the text field to use.
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidAdds a property change listener to this key sequence widget.voidclear()Clears the text field and resets all the internal values.protected final voidfirePropertyChangeEvent(KeySequence oldKeySequence) Fires a property change event to all of the listeners.An accessor for theKeySequencethat corresponds to the current state of the text field.intReturns the maximum number of strokes that are permitted in this widget at one time.voidInserts the key stroke at the current insertion point.final voidRemoves the given listener from this key sequence widget.voidsetKeySequence(KeySequence newKeySequence) A mutator for the key sequence stored within this widget.voidsetKeyStrokeLimit(int keyStrokeLimit) A mutator for the maximum number of strokes that are permitted in this widget at one time.
- 
Field Details- 
INFINITEpublic static final int INFINITEThe special integer value for the maximum number of strokes indicating that an infinite number should be allowed.- See Also:
 
- 
P_KEY_SEQUENCEThe name of the property representing the current key sequence in this key sequence widget.- Since:
- 3.2
- See Also:
 
- 
TRAPPED_KEYSThe keys trapped by this widget. This list is guaranteed to be roughly accurate. Perfection is not possible, as SWT does not export traversal keys as constants.
 
- 
- 
Constructor Details- 
KeySequenceTextConstructs an instance ofKeySequenceTextFieldwith 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.- Parameters:
- wrappedText- The text widget to wrap; must not be- null.
 
 
- 
- 
Method Details- 
addPropertyChangeListenerAdds a property change listener to this key sequence widget. It will be notified when the key sequence changes.- Parameters:
- listener- The listener to be notified when changes occur; must not be- null.
- Since:
- 3.2
 
- 
clearpublic void clear()Clears the text field and resets all the internal values.
- 
firePropertyChangeEventFires a property change event to all of the listeners.- Parameters:
- oldKeySequence- The old key sequence; must not be- null.
- Since:
- 3.2
 
- 
getKeySequenceAn accessor for theKeySequencethat corresponds to the current state of the text field. This includes incomplete strokes.- Returns:
- The key sequence representation; never null.
 
- 
insertInserts the key stroke at the current insertion point. This does a regular delete and insert, as if the key had been pressed.- Parameters:
- stroke- The key stroke to insert; must not be- null.
 
- 
removePropertyChangeListenerRemoves the given listener from this key sequence widget.- Parameters:
- listener- The listener to be removed; must not be- null.
- Since:
- 3.2
 
- 
setKeySequenceA 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. - Parameters:
- newKeySequence- The new key sequence for this widget; may be- nullif none.
 
- 
getKeyStrokeLimitpublic int getKeyStrokeLimit()Returns the maximum number of strokes that are permitted in this widget at one time.- Returns:
- The maximum number of strokes; will be a positive integer or
         INFINITE.
 
- 
setKeyStrokeLimitpublic void setKeyStrokeLimit(int keyStrokeLimit) A mutator for the maximum number of strokes that are permitted in this widget at one time.- Parameters:
- keyStrokeLimit- The maximum number of strokes; must be a positive integer or- INFINITE.
 
 
-