Search in sources :

Example 1 with ValueResourceInfoImpl

use of org.jetbrains.android.resourceManagers.ValueResourceInfoImpl in project android by JetBrains.

the class AndroidFindStyleApplicationsAction method resolveStyleRef.

private static PsiElement resolveStyleRef(StyleRefData styleRef, AndroidFacet facet) {
    final ResourceManager resourceManager = facet.getResourceManager(styleRef.getStylePackage());
    if (resourceManager == null) {
        return null;
    }
    final List<ValueResourceInfoImpl> infos = resourceManager.findValueResourceInfos(ResourceType.STYLE.getName(), styleRef.getStyleName(), true, false);
    return infos.size() == 1 ? infos.get(0).computeXmlElement() : null;
}
Also used : ResourceManager(org.jetbrains.android.resourceManagers.ResourceManager) ValueResourceInfoImpl(org.jetbrains.android.resourceManagers.ValueResourceInfoImpl)

Example 2 with ValueResourceInfoImpl

use of org.jetbrains.android.resourceManagers.ValueResourceInfoImpl in project android by JetBrains.

the class AndroidFindStyleApplicationsProcessor method collectResDir.

private static void collectResDir(Module module, XmlAttributeValue styleNameAttrValue, String styleName, List<VirtualFile> resDirs) {
    final AndroidFacet f = AndroidFacet.getInstance(module);
    if (f == null) {
        return;
    }
    final List<ValueResourceInfoImpl> resolvedStyles = f.getLocalResourceManager().findValueResourceInfos(ResourceType.STYLE.getName(), styleName, true, false);
    if (resolvedStyles.size() == 1) {
        final XmlAttributeValue resolvedStyleNameElement = resolvedStyles.get(0).computeXmlElement();
        if (resolvedStyleNameElement != null && resolvedStyleNameElement.equals(styleNameAttrValue)) {
            resDirs.addAll(f.getAllResourceDirectories());
        }
    }
}
Also used : XmlAttributeValue(com.intellij.psi.xml.XmlAttributeValue) ValueResourceInfoImpl(org.jetbrains.android.resourceManagers.ValueResourceInfoImpl) AndroidFacet(org.jetbrains.android.facet.AndroidFacet)

Aggregations

ValueResourceInfoImpl (org.jetbrains.android.resourceManagers.ValueResourceInfoImpl)2 XmlAttributeValue (com.intellij.psi.xml.XmlAttributeValue)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1 ResourceManager (org.jetbrains.android.resourceManagers.ResourceManager)1