use of com.intellij.xml.XmlNSDescriptor in project intellij-plugins by JetBrains.
the class AngularJSTagDescriptorsProvider method getDescriptor.
@Nullable
@Override
public XmlElementDescriptor getDescriptor(XmlTag xmlTag) {
final Project project = xmlTag.getProject();
if (!(xmlTag instanceof HtmlTag && AngularIndexUtil.hasAngularJS(project)))
return null;
final String tagName = xmlTag.getName();
final String directiveName = DirectiveUtil.normalizeAttributeName(tagName);
final XmlNSDescriptor nsDescriptor = xmlTag.getNSDescriptor(xmlTag.getNamespace(), false);
final XmlElementDescriptor descriptor = nsDescriptor != null ? nsDescriptor.getElementDescriptor(xmlTag) : null;
if (descriptor != null && !(descriptor instanceof AnyXmlElementDescriptor)) {
return null;
}
if ((NG_CONTAINER.equals(directiveName) || NG_CONTENT.equals(directiveName) || NG_TEMPLATE.equals(directiveName)) && AngularIndexUtil.hasAngularJS2(project)) {
return new AngularJSTagDescriptor(directiveName, createDirective(xmlTag, directiveName));
}
JSImplicitElement directive = DirectiveUtil.getTagDirective(directiveName, project);
if (DirectiveUtil.isAngular2Directive(directive) && !directive.getName().equals(tagName)) {
// we've found directive via normalized name for Angular, it should not work
directive = null;
}
if (directive == null && !tagName.equals(directiveName) && AngularIndexUtil.hasAngularJS2(project)) {
directive = DirectiveUtil.getTagDirective(tagName, project);
if (!DirectiveUtil.isAngular2Directive(directive))
directive = null;
}
return directive != null ? new AngularJSTagDescriptor(directiveName, directive) : null;
}
use of com.intellij.xml.XmlNSDescriptor in project intellij-plugins by JetBrains.
the class Struts2GlobalVariableProvider method installTaglibSupport.
private static void installTaglibSupport(@NotNull final List<FtlVariable> result, @NotNull final Module module, @NotNull @NonNls final String taglibUri, @NotNull @NonNls final String taglibPrefix) {
final XmlFile xmlFile = JspManager.getInstance(module.getProject()).getTldFileByUri(taglibUri, module, null);
if (xmlFile == null) {
return;
}
final XmlDocument document = xmlFile.getDocument();
if (document == null) {
return;
}
final XmlNSDescriptor descriptor = (XmlNSDescriptor) document.getMetaData();
if (descriptor == null) {
return;
}
PsiElement declaration = descriptor.getDeclaration();
if (declaration == null) {
declaration = xmlFile;
}
result.add(new MyFtlLightVariable(taglibPrefix, declaration, new FtlXmlNamespaceType(descriptor)));
}
Aggregations