Search in sources :

Example 1 with AntDomProperty

use of com.intellij.lang.ant.dom.AntDomProperty in project intellij-community by JetBrains.

the class AntMissingPropertiesFileInspection method checkDomElement.

protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
    if (element instanceof AntDomProperty) {
        final AntDomProperty property = (AntDomProperty) element;
        final GenericAttributeValue<PsiFileSystemItem> fileValue = property.getFile();
        final String fileName = fileValue.getStringValue();
        if (fileName != null) {
            final PropertiesFile propertiesFile = property.getPropertiesFile();
            if (propertiesFile == null) {
                final PsiFileSystemItem file = fileValue.getValue();
                if (file instanceof XmlFile) {
                    holder.createProblem(fileValue, AntBundle.message("file.type.xml.not.supported", fileName));
                } else if (file instanceof PsiFile) {
                    holder.createProblem(fileValue, AntBundle.message("file.type.not.supported", fileName));
                } else {
                    holder.createProblem(fileValue, AntBundle.message("file.doesnt.exist", fileName));
                }
            }
        }
    }
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) PropertiesFile(com.intellij.lang.properties.psi.PropertiesFile) PsiFile(com.intellij.psi.PsiFile) PsiFileSystemItem(com.intellij.psi.PsiFileSystemItem) AntDomProperty(com.intellij.lang.ant.dom.AntDomProperty)

Aggregations

AntDomProperty (com.intellij.lang.ant.dom.AntDomProperty)1 PropertiesFile (com.intellij.lang.properties.psi.PropertiesFile)1 PsiFile (com.intellij.psi.PsiFile)1 PsiFileSystemItem (com.intellij.psi.PsiFileSystemItem)1 XmlFile (com.intellij.psi.xml.XmlFile)1