ContextProvider (PsiFile psiFile) { if (psiFile instanceof XPathFile) { final ContextProvider instance = ContextProviderExtension.getInstance((XPathFile)psiFile); if (instance != null) { instance.attachTo(psiFile); return instance; } } return new DefaultProvider(PsiTreeUtil.getContextOfType(psiFile, XmlElement.class, true), psiFile.getLanguage()); }