}
private void buildWidgetDefinition(Element widgetDefinition, WidgetDefinitionBuilderContext context)
throws Exception {
String widgetName = widgetDefinition.getLocalName();
WidgetDefinitionBuilder builder;
try {
builder = (WidgetDefinitionBuilder) widgetDefinitionBuilderSelector.select(widgetName);
} catch (ServiceException e) {
throw new LibraryException("Unknown kind of widget '" + widgetName + "'.",
e, DomHelper.getLocationObject(widgetDefinition));
}
context.setSuperDefinition(null);
String extend = DomHelper.getAttribute(widgetDefinition, "extends", null);
if (extend != null) {
context.setSuperDefinition(getDefinition(extend));
}
WidgetDefinition definition = builder.buildWidgetDefinition(widgetDefinition, context);
addDefinition(definition);
}