Search in sources :

Example 1 with ManifestElementWithRequiredName

use of org.jetbrains.android.dom.manifest.ManifestElementWithRequiredName in project kotlin by JetBrains.

the class KotlinAndroidGotoDeclarationHandler method collectManifestElements.

private static void collectManifestElements(@NotNull String nestedClassName, @NotNull String fieldName, @NotNull AndroidFacet facet, @NotNull List<PsiElement> result) {
    Manifest manifest = facet.getManifest();
    if (manifest == null) {
        return;
    }
    List<? extends ManifestElementWithRequiredName> list;
    if ("permission".equals(nestedClassName)) {
        list = manifest.getPermissions();
    } else if ("permission_group".equals(nestedClassName)) {
        list = manifest.getPermissionGroups();
    } else {
        return;
    }
    for (ManifestElementWithRequiredName domElement : list) {
        AndroidAttributeValue<String> nameAttribute = domElement.getName();
        String name = nameAttribute.getValue();
        if (AndroidUtils.equal(name, fieldName, false)) {
            XmlElement psiElement = nameAttribute.getXmlAttributeValue();
            if (psiElement != null) {
                result.add(psiElement);
            }
        }
    }
}
Also used : ManifestElementWithRequiredName(org.jetbrains.android.dom.manifest.ManifestElementWithRequiredName) XmlElement(com.intellij.psi.xml.XmlElement) Manifest(org.jetbrains.android.dom.manifest.Manifest)

Example 2 with ManifestElementWithRequiredName

use of org.jetbrains.android.dom.manifest.ManifestElementWithRequiredName in project android by JetBrains.

the class AndroidGotoDeclarationHandler method collectManifestElements.

private static void collectManifestElements(@NotNull String nestedClassName, @NotNull String fieldName, @NotNull AndroidFacet facet, @NotNull List<PsiElement> result) {
    final Manifest manifest = facet.getManifest();
    if (manifest == null) {
        return;
    }
    List<? extends ManifestElementWithRequiredName> list;
    if ("permission".equals(nestedClassName)) {
        list = manifest.getPermissions();
    } else if ("permission_group".equals(nestedClassName)) {
        list = manifest.getPermissionGroups();
    } else {
        return;
    }
    for (ManifestElementWithRequiredName domElement : list) {
        final AndroidAttributeValue<String> nameAttribute = domElement.getName();
        final String name = nameAttribute.getValue();
        if (AndroidUtils.equal(name, fieldName, false)) {
            final XmlElement psiElement = nameAttribute.getXmlAttributeValue();
            if (psiElement != null) {
                result.add(psiElement);
            }
        }
    }
}
Also used : ManifestElementWithRequiredName(org.jetbrains.android.dom.manifest.ManifestElementWithRequiredName) XmlElement(com.intellij.psi.xml.XmlElement) Manifest(org.jetbrains.android.dom.manifest.Manifest)

Aggregations

XmlElement (com.intellij.psi.xml.XmlElement)2 Manifest (org.jetbrains.android.dom.manifest.Manifest)2 ManifestElementWithRequiredName (org.jetbrains.android.dom.manifest.ManifestElementWithRequiredName)2