if ((contextId == null) || (contextId.length() == 0)) {
contextId = IContextIds.CONTEXT_ID_WINDOW;
}
// Read out the key sequence.
KeySequence keySequence = null;
String keySequenceText = configurationElement
.getAttribute(ATT_SEQUENCE);
if ((keySequenceText == null) || (keySequenceText.length() == 0)) {
keySequenceText = configurationElement
.getAttribute(ATT_KEY_SEQUENCE);
}
if ((keySequenceText == null) || (keySequenceText.length() == 0)) {
keySequenceText = configurationElement.getAttribute(ATT_STRING);
if ((keySequenceText == null)
|| (keySequenceText.length() == 0)) {
// The key sequence should never be null. This is pointless
addWarning(
warningsToLog,
"Defining a key binding with no key sequence has no effect", //$NON-NLS-1$
configurationElement, commandId);
continue;
}
// The key sequence is in the old-style format.
try {
keySequence = convert2_1Sequence(parse2_1Sequence(keySequenceText));
} catch (final IllegalArgumentException e) {
addWarning(warningsToLog, "Could not parse key sequence", //$NON-NLS-1$
configurationElement, commandId, "keySequence", //$NON-NLS-1$
keySequenceText);
continue;
}
} else {
// The key sequence is in the new-style format.
try {
keySequence = KeySequence.getInstance(keySequenceText);
} catch (final ParseException e) {
addWarning(warningsToLog, "Could not parse key sequence", //$NON-NLS-1$
configurationElement, commandId, "keySequence", //$NON-NLS-1$
keySequenceText);
continue;
}
if (keySequence.isEmpty() || !keySequence.isComplete()) {
addWarning(
warningsToLog,
"Key bindings should not have an empty or incomplete key sequence", //$NON-NLS-1$
configurationElement, commandId, "keySequence", //$NON-NLS-1$
keySequence.toString());
continue;
}
}