// adding a binding
if (UIEvents.EventTypes.ADD.equals(event
.getProperty(UIEvents.EventTags.TYPE))
&& newObj instanceof MKeyBinding) {
MKeyBinding binding = (MKeyBinding) newObj;
updateBinding(binding, true, elementObj);
}
// removing a binding
else if (UIEvents.EventTypes.REMOVE.equals(event
.getProperty(UIEvents.EventTags.TYPE))
&& oldObj instanceof MKeyBinding) {
MKeyBinding binding = (MKeyBinding) oldObj;
updateBinding(binding, false, elementObj);
}
} else if (elementObj instanceof MKeyBinding) {
MKeyBinding binding = (MKeyBinding) elementObj;
String attrName = (String) event
.getProperty(UIEvents.EventTags.ATTNAME);
if (UIEvents.EventTypes.SET.equals(event
.getProperty(UIEvents.EventTags.TYPE))) {
Object oldObj = event
.getProperty(UIEvents.EventTags.OLD_VALUE);
if (UIEvents.KeyBinding.COMMAND.equals(attrName)) {
MKeyBinding oldBinding = (MKeyBinding) EcoreUtil
.copy((EObject) binding);
oldBinding.setCommand((MCommand) oldObj);
updateBinding(oldBinding, false,
((EObject) binding).eContainer());
updateBinding(binding, true, null);
} else if (UIEvents.KeySequence.KEYSEQUENCE
.equals(attrName)) {
MKeyBinding oldBinding = (MKeyBinding) EcoreUtil
.copy((EObject) binding);
oldBinding.setKeySequence((String) oldObj);
updateBinding(oldBinding, false,
((EObject) binding).eContainer());
updateBinding(binding, true, null);
}
} else if (UIEvents.KeyBinding.PARAMETERS.equals(attrName)) {
if (UIEvents.EventTypes.ADD.equals(event
.getProperty(UIEvents.EventTags.TYPE))) {
Object newObj = event
.getProperty(UIEvents.EventTags.NEW_VALUE);
MKeyBinding oldBinding = (MKeyBinding) EcoreUtil
.copy((EObject) binding);
oldBinding.getParameters().remove(newObj);
updateBinding(oldBinding, false,
((EObject) binding).eContainer());
updateBinding(binding, true, null);
} else if (UIEvents.EventTypes.REMOVE.equals(event
.getProperty(UIEvents.EventTags.TYPE))) {
Object oldObj = event
.getProperty(UIEvents.EventTags.OLD_VALUE);
MKeyBinding oldBinding = (MKeyBinding) EcoreUtil
.copy((EObject) binding);
oldBinding.getParameters().add((MParameter) oldObj);
updateBinding(oldBinding, false,
((EObject) binding).eContainer());
updateBinding(binding, true, null);
}
}