diff options
Diffstat (limited to 'plugins/devkit/src/dom/impl/PluginXmlDomFileDescription.java')
-rw-r--r-- | plugins/devkit/src/dom/impl/PluginXmlDomFileDescription.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/plugins/devkit/src/dom/impl/PluginXmlDomFileDescription.java b/plugins/devkit/src/dom/impl/PluginXmlDomFileDescription.java index 80a3aabce8f3..b3d7fda2c19a 100644 --- a/plugins/devkit/src/dom/impl/PluginXmlDomFileDescription.java +++ b/plugins/devkit/src/dom/impl/PluginXmlDomFileDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +21,20 @@ import com.intellij.lang.annotation.Annotation; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.util.Iconable; import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiField; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.DomFileDescription; import com.intellij.util.xml.DomUtil; import com.intellij.util.xml.GenericAttributeValue; import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; import com.intellij.util.xml.highlighting.DomElementsAnnotator; +import com.intellij.util.xml.reflect.DomAttributeChildDescription; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.devkit.dom.*; import javax.swing.*; +import java.util.List; /** * @author mike @@ -73,12 +77,29 @@ public class PluginXmlDomFileDescription extends DomFileDescription<IdeaPlugin> final ExtensionPoint extensionPoint = extension.getExtensionPoint(); if (extensionPoint == null) return; final GenericAttributeValue<PsiClass> interfaceAttribute = extensionPoint.getInterface(); - if (!DomUtil.hasXml(interfaceAttribute)) return; + if (DomUtil.hasXml(interfaceAttribute)) { + final PsiClass value = interfaceAttribute.getValue(); + if (value != null && value.isDeprecated()) { + final Annotation annotation = holder.createAnnotation(extension, HighlightSeverity.WARNING, "Deprecated EP"); + annotation.setHighlightType(ProblemHighlightType.LIKE_DEPRECATED); + return; + } + } - final PsiClass value = interfaceAttribute.getValue(); - if (value != null && value.isDeprecated()) { - final Annotation annotation = holder.createAnnotation(extension, HighlightSeverity.WARNING, "Deprecated EP"); - annotation.setHighlightType(ProblemHighlightType.LIKE_DEPRECATED); + final List<? extends DomAttributeChildDescription> descriptions = extension.getGenericInfo().getAttributeChildrenDescriptions(); + for (DomAttributeChildDescription attributeDescription : descriptions) { + final GenericAttributeValue attributeValue = attributeDescription.getDomAttributeValue(extension); + if (attributeValue == null || !DomUtil.hasXml(attributeValue)) continue; + + final PsiElement declaration = attributeDescription.getDeclaration(extension.getManager().getProject()); + if (declaration instanceof PsiField) { + PsiField psiField = (PsiField)declaration; + if (psiField.isDeprecated()) { + final Annotation annotation = holder.createAnnotation(attributeValue, HighlightSeverity.WARNING, + "Deprecated attribute '" + attributeDescription.getName() + "'"); + annotation.setHighlightType(ProblemHighlightType.LIKE_DEPRECATED); + } + } } } |