Search in sources :

Example 1 with MenuDomFileDescription

use of org.jetbrains.android.dom.menu.MenuDomFileDescription in project android by JetBrains.

the class AndroidMissingOnClickHandlerInspection method checkFile.

@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
    if (!(file instanceof XmlFile)) {
        return ProblemDescriptor.EMPTY_ARRAY;
    }
    final AndroidFacet facet = AndroidFacet.getInstance(file);
    if (facet == null) {
        return ProblemDescriptor.EMPTY_ARRAY;
    }
    final DomFileDescription<?> description = DomManager.getDomManager(file.getProject()).getDomFileDescription((XmlFile) file);
    if (!(description instanceof LayoutDomFileDescription) && !(description instanceof MenuDomFileDescription)) {
        return ProblemDescriptor.EMPTY_ARRAY;
    }
    final Collection<PsiClass> activities = findRelatedActivities((XmlFile) file, facet, description);
    final MyVisitor visitor = new MyVisitor(manager, isOnTheFly, activities);
    file.accept(visitor);
    return visitor.myResult.toArray(new ProblemDescriptor[visitor.myResult.size()]);
}
Also used : LayoutDomFileDescription(org.jetbrains.android.dom.layout.LayoutDomFileDescription) XmlFile(com.intellij.psi.xml.XmlFile) MenuDomFileDescription(org.jetbrains.android.dom.menu.MenuDomFileDescription) AndroidFacet(org.jetbrains.android.facet.AndroidFacet)

Aggregations

XmlFile (com.intellij.psi.xml.XmlFile)1 LayoutDomFileDescription (org.jetbrains.android.dom.layout.LayoutDomFileDescription)1 MenuDomFileDescription (org.jetbrains.android.dom.menu.MenuDomFileDescription)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1