Search in sources :

Example 1 with MetaDataRegistrar

use of com.intellij.psi.meta.MetaDataRegistrar in project intellij-community by JetBrains.

the class ApplicationLoader method registerMetaData.

private static void registerMetaData() {
    final MetaDataRegistrar registrar = MetaDataRegistrar.getInstance();
    registrar.registerMetaData(new AndFilter(new NamespaceFilter(RNG_NAMESPACE), new ClassFilter(XmlDocument.class)), RngNsDescriptor.class);
    registrar.registerMetaData(new ClassFilter(RncDocument.class), RngNsDescriptor.class);
    registrar.registerMetaData(new ElementFilter() {

        @Override
        public boolean isAcceptable(Object element, PsiElement context) {
            if (element instanceof XmlTag) {
                final XmlTag tag = (XmlTag) element;
                final DomElement domElement = DomManager.getDomManager(tag.getProject()).getDomElement(tag);
                return domElement instanceof RngDefine;
            }
            return false;
        }

        @Override
        public boolean isClassAcceptable(Class hintClass) {
            return XmlTag.class.isAssignableFrom(hintClass);
        }
    }, RngDefineMetaData.class);
}
Also used : AndFilter(com.intellij.psi.filters.AndFilter) RngDefine(org.intellij.plugins.relaxNG.xml.dom.RngDefine) DomElement(com.intellij.util.xml.DomElement) NamespaceFilter(com.intellij.psi.filters.position.NamespaceFilter) MetaDataRegistrar(com.intellij.psi.meta.MetaDataRegistrar) ClassFilter(com.intellij.psi.filters.ClassFilter) ElementFilter(com.intellij.psi.filters.ElementFilter) PsiElement(com.intellij.psi.PsiElement) RncDocument(org.intellij.plugins.relaxNG.compact.psi.impl.RncDocument) XmlTag(com.intellij.psi.xml.XmlTag)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 AndFilter (com.intellij.psi.filters.AndFilter)1 ClassFilter (com.intellij.psi.filters.ClassFilter)1 ElementFilter (com.intellij.psi.filters.ElementFilter)1 NamespaceFilter (com.intellij.psi.filters.position.NamespaceFilter)1 MetaDataRegistrar (com.intellij.psi.meta.MetaDataRegistrar)1 XmlTag (com.intellij.psi.xml.XmlTag)1 DomElement (com.intellij.util.xml.DomElement)1 RncDocument (org.intellij.plugins.relaxNG.compact.psi.impl.RncDocument)1 RngDefine (org.intellij.plugins.relaxNG.xml.dom.RngDefine)1