boolean (@Nullable Project project, @NotNull VirtualFile file) { if (project == null || !project.isInitialized()) { if (!FileUtilRt.extensionEquals(file.getName(), "xml")) return false; try { try (InputStream in = file.getInputStream()) { Ref<Boolean> isPomFile = Ref.create(false); Reader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); NanoXmlUtil.parse(reader, new NanoXmlBuilder() { @Override public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr) throws Exception { if ("project".equals(name)) { isPomFile.set(nsURI.startsWith("http://maven.apache.org/POM/")); } stop(); } }); return isPomFile.get(); } } catch (IOException ignore) { return false; } } MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(project); if (mavenProjectsManager.findProject(file) != null) return true; return ReadAction.compute(() -> { if (project.isDisposed()) return false; PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (psiFile == null) return false; return MavenDomUtil.isProjectFile(psiFile); }); }