includeType = true;
}
IJavaProject javaProject = projectProvider.getJavaProject(element.eResource().getResourceSet());
try {
IType defType = javaProject.findType(element.getType().getQualifiedName());
ReferenceValueProperty rp = (ReferenceValueProperty) model;
IType targetType = null;
if( rp.eContainer() instanceof Property ) {
Property p = (Property) rp.eContainer();
if( p.eContainer() instanceof Element ) {
Element e = (Element) p.eContainer();
IType ownerType = javaProject.findType(e.getType().getQualifiedName());
IFXClass ownerClass = FXPlugin.getClassmodel().findClass(javaProject, ownerType);
IFXProperty ownerProp = ownerClass.getProperty(p.getName());
if( ownerProp instanceof IFXObjectProperty ) {
targetType = ((IFXObjectProperty) ownerProp).getElementType();
}
}
} else if( rp.eContainer() instanceof StaticCallValueProperty ) {
LOGGER.warn("Unable to extract type for " + rp.eContainer());
} else if( rp.eContainer() instanceof ListValueProperty ) {
ListValueProperty lvp = (ListValueProperty) rp.eContainer();
if( lvp.eContainer() instanceof Property ) {
Property p = (Property) lvp.eContainer();
if( p.eContainer() instanceof Element ) {
Element e = (Element) p.eContainer();
IType ownerType = javaProject.findType(e.getType().getQualifiedName());
IFXClass ownerClass = FXPlugin.getClassmodel().findClass(javaProject, ownerType);
IFXProperty ownerProp = ownerClass.getProperty(p.getName());
if( ownerProp instanceof IFXCollectionProperty ) {
targetType = ((IFXCollectionProperty) ownerProp).getElementType();
}
}
} else {
LOGGER.warn("Unable to extract type for " + rp.eContainer());
}
}
if( targetType != null ) {
if( Util.assignable(defType, targetType) ) {