// try @UiTemplate
IType uiTemplateType = m_javaProject.findType("com.google.gwt.uibinder.client.UiTemplate");
List<IJavaElement> references = CodeUtils.searchReferences(uiTemplateType);
for (IJavaElement reference : references) {
if (reference instanceof IAnnotation) {
IAnnotation annotation = (IAnnotation) reference;
IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
if (valuePairs.length == 1 && valuePairs[0].getValue() instanceof String) {
String templateName = (String) valuePairs[0].getValue();
// prepare ICompilationUnit
ICompilationUnit compilationUnit =
(ICompilationUnit) annotation.getAncestor(IJavaElement.COMPILATION_UNIT);
// prepare qualified template name
templateName = StringUtils.removeEnd(templateName, ".ui.xml");
if (templateName.contains(".")) {
templateName = templateName.replace('.', '/');
} else {
String packageName = compilationUnit.getPackageDeclarations()[0].getElementName();
templateName = packageName.replace('.', '/') + "/" + templateName;
}
templateName += ".ui.xml";
// if found, initialize "form" element
if (m_binderResourceName.equals(templateName)) {
m_formType = (IType) annotation.getParent().getParent();
m_formClassName = m_formType.getFullyQualifiedName();
m_formFile = (IFile) m_formType.getCompilationUnit().getUnderlyingResource();
prepareBinderClass();
if (m_binderClassName != null) {
return;