if (IConstants.XAML_X_TYPE.equalsIgnoreCase(name)
&& constraintType != null && constraintType == Class.class) {
DocumentObject[] children = element.getChildren();
if (children != null && children.length > 0) {
if (children[0] instanceof Element) {
Element type = (Element) children[0];
IMetaclass metaclass = loader.getMetaclass(type
.getName(), type.getNamespace());
if (metaclass != null) {
return metaclass.getType();
}
}
} else {
String content = element.getContent();
return loader.convertFrom(Class.class, content);
}
}
return null;
}
IMetaclass metaclass = loader.getMetaclass(name, namespace);
if (constraintType != null
&& !(IBinding.class.isAssignableFrom(metaclass.getType()))
&& (!constraintType.isAssignableFrom(metaclass.getType()))) {
if (!constraintType.isArray()
|| !constraintType.getComponentType().isAssignableFrom(
metaclass.getType())) {
return null;
}
}
Object targetObject = null;
Integer styleValue = getStyleValue(element, styles);
if (parent == null || metaclass.getType() == Shell.class) {
if (dataBindingTrack != null) {
dataBindingTrack.addWidgetElement(element);
}
Shell shell = null;
if (styleValue == null || styleValue == -1) {
styleValue = SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX
| SWT.RESIZE;
}
Display display = Display.getDefault();
shell = new Shell(display, styleValue);
targetObject = shell;
invokeCreatededAction(element, targetObject);
loadData.setCurrentWidget(shell);
if (metaclass.getType() != Shell.class) {
shell.setLayout(new FillLayout());
return doCreate(targetObject, element, constraintType, options);
} else {
if (bindingContext != null) {
setBindingContext(metaclass, targetObject, dico,
bindingContext);
}
if (dataContext != null) {
setDataContext(metaclass, targetObject, dico, dataContext);
}
}
pushStack(parent);
// for Shell
Attribute classAttribute = element.getAttribute(
IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_CLASS);
if (classAttribute != null) {
String className = classAttribute.getContent();
loadShellCLR(className, shell);
}
} else {
pushStack(parent);
//
// load the content in case of UserControl
//
Class<?> type = metaclass.getType();
URL file = type.getResource(type.getSimpleName()
+ IConstants.XWT_EXTENSION_SUFFIX);
if (file != null && nameScoped != null) {
if (parent instanceof Composite) {
Object childDataContext = getDataContext(element,
(Widget) parent);