public class LetterOrDigitKeyEventMatcher extends Object implements IKeyEventMatcher
IKeyEventMatcher
implementation that will check if a pressed key
is a letter or digit key, in combination with the configured state mask
for the keyboard modifier.
Since 1.0.0 this matcher has evolved to match more than only letter or digit keys. It will now also check for several special characters that are able to be populated to an editor like e.g. the question mark. The following regular expression will be used by this matcher: [\\.:,;\\-_#\'+*~!?ยง$%&/()\\[\\]\\{\\}=\\\\\"]
Constructor and Description |
---|
LetterOrDigitKeyEventMatcher()
Will create a new key event matcher that accepts no keyboard
modifiers on typing a key.
|
LetterOrDigitKeyEventMatcher(int stateMask)
Will create a new key event matcher that accepts only the given
keyboard modifiers on typing a key.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
isLetterOrDigit(char character)
Will check if the given character is a letter or digit character, and moreover
will check special characters that can be typed that will cause a character to
be printed.
|
boolean |
matches(org.eclipse.swt.events.KeyEvent event) |
public LetterOrDigitKeyEventMatcher()
public LetterOrDigitKeyEventMatcher(int stateMask)
stateMask
- The state of the keyboard modifier keys at the time
the event was generated, as defined by the key code
constants in class SWT
.public boolean matches(org.eclipse.swt.events.KeyEvent event)
matches
in interface IKeyEventMatcher
public static boolean isLetterOrDigit(char character)
This method is intended to be used to determine whether a keypress is able to open an editor, populating the representing character of the key to the editor.
character
- The character to check if it is a letter, digit or
specified special character.true
if the character is an acceptable character,
false
if not.Copyright © 2013. All Rights Reserved.