use of com.android.tools.idea.res.DataBindingInfo in project android by JetBrains.
the class DataBindingXmlReferenceContributor method getDataBindingInfo.
@Nullable
public static DataBindingInfo getDataBindingInfo(PsiElement element) {
DataBindingInfo dataBindingInfo = null;
Module module = ModuleUtilCore.findModuleForPsiElement(element);
if (module != null) {
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null && facet.isDataBindingEnabled()) {
LocalResourceRepository moduleResources = facet.getModuleResources(true);
PsiFile topLevelFile = InjectedLanguageUtil.getTopLevelFile(element);
if (topLevelFile != null) {
String name = topLevelFile.getName();
name = name.substring(0, name.lastIndexOf('.'));
dataBindingInfo = moduleResources.getDataBindingInfoForLayout(name);
}
}
}
return dataBindingInfo;
}
Aggregations