}
}
@Override
public void validateReferences() throws QuickFixException {
EventDef event = null;
if (name == null && descriptor != null) {
event = descriptor.getDef();
if (event == null) {
throw new InvalidReferenceException(String.format("aura:handler has invalid event attribute value: %s",
descriptor), getLocation());
}
if (!event.getEventType().equals(EventType.APPLICATION)) {
throw new InvalidReferenceException(
"A aura:handler that specifies an event=\"\" attribute must handle an application event. Either change the aura:event to have type=\"APPLICATION\" or alternately change the aura:handler to specify a name=\"\" attribute.",
getLocation());
}
} else if (name != null && descriptor == null && value == null) {
RootDefinition parentDef = parentDescriptor.getDef();
Map<String, RegisterEventDef> events = parentDef.getRegisterEventDefs();
RegisterEventDef registerEvent = events.get(name);
if (registerEvent == null) {
throw new InvalidReferenceException(String.format("aura:handler has invalid name attribute value: %s",
name), getLocation());
}
event = registerEvent.getDescriptor().getDef();
if (!event.getEventType().equals(EventType.COMPONENT)) {
throw new InvalidReferenceException(
"A aura:handler that specifies a name=\"\" attribute must handle a component event. Either change the aura:event to have type=\"COMPONENT\" or alternately change the aura:handler to specify an event=\"\" attribute.",
getLocation());
}
}