XmlElementDescriptor[] (XmlTag context) { if (context == null) { return EMPTY_ARRAY; } // TODO: Not sure why this is needed. IDEA sometimes asks us for descriptors with a context that doesn't match our // element pattern. At least at namespace boundaries... final DElementPattern pattern; final XmlElementDescriptor descriptor = myNsDescriptor.getElementDescriptor(context); if (descriptor instanceof RngElementDescriptor) { final DElementPattern p = ((RngElementDescriptor)descriptor).myElementPattern; pattern = p != null ? p : myElementPattern; } else { pattern = myElementPattern; } final List<DElementPattern> patterns = ChildElementFinder.find(2, pattern); return myNsDescriptor.convertElementDescriptors(patterns); }