public static IType resolveElementToJavaType(IDOMElement element,IJavaProject javaProject){
  String qualifiedTypeName=computeQualifiedWidgetTypeName(element);
  if (qualifiedTypeName == null) {
    Node typeAttr=getTypeAttribute(element);
    if (typeAttr != null) {
      qualifiedTypeName=typeAttr.getNodeValue();
    }
  }
  if (qualifiedTypeName == null) {
    if (isImageElement(element)) {
      qualifiedTypeName=UiBinderConstants.UI_BINDER_IMAGE_RESOURCE_NAME;
    }
 else     if (isDataElement(element)) {
      qualifiedTypeName=UiBinderConstants.UI_BINDER_DATA_RESOURCE_NAME;
    }
 else     if (isImportElement(element)) {
      Node node=getFieldAttribute(element);
      if (node == null) {
        return null;
      }
      String qualifiedConstant=node.getNodeValue();
      int index=qualifiedConstant.lastIndexOf('.');
      if (index != -1) {
        qualifiedTypeName=qualifiedConstant.substring(0,index);
      }
    }
  }
  if (qualifiedTypeName == null) {
    return null;
  }
  try {
    return javaProject.findType(qualifiedTypeName);
  }
 catch (  JavaModelException e) {
    GWTPluginLog.logWarning(e,"Could not resolve element to Java type.");
    return null;
  }
}

public static IType resolveElementToJavaType ( IDOMElement element , IJavaProject javaProject ) { String qualifiedTypeName = computeQualifiedWidgetTypeName ( element ) ; if ( qualifiedTypeName == null ) { Node typeAttr = getTypeAttribute ( element ) ; if ( typeAttr != null ) { qualifiedTypeName = typeAttr . getNodeValue ( ) ; } } if ( qualifiedTypeName == null ) { if ( isImageElement ( element ) ) { qualifiedTypeName = UiBinderConstants . UI_BINDER_IMAGE_RESOURCE_NAME ; } else if ( isDataElement ( element ) ) { qualifiedTypeName = UiBinderConstants . UI_BINDER_DATA_RESOURCE_NAME ; } else if ( isImportElement ( element ) ) { Node node = getFieldAttribute ( element ) ; if ( node == null ) { return null ; } String qualifiedConstant = node . getNodeValue ( ) ; int index = qualifiedConstant . lastIndexOf ( '.' ) ; if ( index != - 1 ) { qualifiedTypeName = qualifiedConstant . substring ( 0 , index ) ; } } } if ( qualifiedTypeName == null ) { return null ; } try { return javaProject . findType ( qualifiedTypeName ) ; } catch ( JavaModelException e ) { GWTPluginLog . logWarning ( e , "Could not resolve element to Java type." ) ; return null ; } }
resolves an element to its corresponding java type . this deals with widget types and style / with / image / data elements .
