IDefinition mxInternalDef = mxInternalReference.resolve(flexProject);
if (!(mxInternalDef instanceof NamespaceDefinition))
return false;
IResolvedQualifiersReference registerEffectTriggerRef =
ReferenceFactory.resolvedQualifierQualifiedReference(flexProject.getWorkspace(), (INamespaceDefinition)mxInternalDef,
"registerEffectTrigger");
Name registerEffectTriggerName = registerEffectTriggerRef.getMName();
initMethod.addInstruction(ABCConstants.OP_getlex, effectManagerReference.getMName());
for (Map.Entry<String, String> effectEntry : effectNameToTriggerMap.entrySet())
{
initMethod.addInstruction(ABCConstants.OP_dup); // copy the effectManager class closure
initMethod.addInstruction(ABCConstants.OP_pushstring, effectEntry.getKey());
initMethod.addInstruction(ABCConstants.OP_pushstring, effectEntry.getValue());
initMethod.addInstruction(ABCConstants.OP_callpropvoid, new Object[] { registerEffectTriggerName, 2 });
}
initMethod.addInstruction(ABCConstants.OP_pop);
}
// Initialize AccessibilityClasses. Below is example code. Each
// accessibility class found by the compiler will have its
// enableAccessibility() method called.
//
// if (Capabilities.hasAccessibility) {
// spark.accessibility.TextBaseAccImpl.enableAccessibility();
// mx.accessibility.UIComponentAccProps.enableAccessibility();
// spark.accessibility.ButtonBaseAccImpl.enableAccessibility();
// }
if (targetSettings.isAccessible())
{
Name capabilitiesSlotName = capabilitiesReference.getMName();
initMethod.addInstruction(ABCConstants.OP_findpropstrict, capabilitiesSlotName);
initMethod.addInstruction(ABCConstants.OP_getproperty, capabilitiesSlotName);
initMethod.addInstruction(ABCConstants.OP_getproperty, new Name("hasAccessibility"));
Label accessibilityEnd = new Label();
initMethod.addInstruction(ABCConstants.OP_iffalse, accessibilityEnd);
IResolvedQualifiersReference enableAccessibilityReference = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
"enableAccessibility");
Name enableAccessibilityName = enableAccessibilityReference.getMName();
Object[] enableAccessibilityCallPropOperands = new Object[] { enableAccessibilityName, 0 };
for (String accessibilityClassName : accessibleClassNames)
{
IResolvedQualifiersReference ref = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
accessibilityClassName);
Name accName = ref.getMName();
initMethod.addInstruction(ABCConstants.OP_getlex, accName);
initMethod.addInstruction(ABCConstants.OP_callproperty, enableAccessibilityCallPropOperands);
initMethod.addInstruction(ABCConstants.OP_pop);
}