* Adds bindings based on attributes in the template.
*/
private void addTemplateBindings(IComponent component, OpenToken token)
{
IComponentSpecification spec = component.getSpecification();
Map attributes = token.getAttributesMap();
if (attributes != null)
{
Iterator i = attributes.entrySet().iterator();
while (i.hasNext())
{
Map.Entry entry = (Map.Entry) i.next();
String name = (String) entry.getKey();
String value = (String) entry.getValue();
String description = ImplMessages.templateParameterName(name);
// For informal parameters, or formal parameters that don't define a default binding
// type,
// treat the value as a literal.
String defaultBindingType = BindingUtils.getDefaultBindingType(
spec,
name,
BindingConstants.LITERAL_PREFIX);
IBinding binding = _bindingSource.createBinding(
_loadComponent,
description,
value,
defaultBindingType,
token.getLocation());
addBinding(component, spec, name, binding);
}
}
// if the component defines a templateTag parameter and
// there is no established binding for that parameter,
// add a static binding carrying the template tag
if (spec.getParameter(TemplateSource.TEMPLATE_TAG_PARAMETER_NAME) != null
&& component.getBinding(TemplateSource.TEMPLATE_TAG_PARAMETER_NAME) == null)
{
IBinding binding = _bindingSource.createBinding(
component,
TemplateSource.TEMPLATE_TAG_PARAMETER_NAME,