private void parseXmlForSql(VirtualFile xmlFile) { final AnnoRefSettings annoRefState = AnnoRefConfigSettings.getInstance(project).getAnnoRefState(); if (annoRefState.ENABLE_SQL_TO_MODEL_VALIDATION) { logger.info(AnnoRefBundle.message("annoRef.xml.parse.sql.validation.enabled")); final XmlBuilderDriver xmlBuilderDriver = new XmlBuilderDriver( AnnRefApplication.getPsiFileFromVirtualFile(xmlFile, project).getText()); xmlBuilderDriver.build(new AnnoRefXmlVisitor(project, xmlFile)); } logger.info(AnnoRefBundle.message("annoRef.xml.parse..sql.validation.disabled")); }
private void scanXmlFile(final VirtualFile xmlFile) { String xmlFileName = xmlFile.getName(); if (SQLRefNamingUtil.isMatchFileName(xmlFileName, QUERIES_FILE_REGEX_PATTERN)) { XmlVisitorListener xmlVisitorListener = new XmlVisitorListener() { @Override public void foundValidRefId(String refID, PsiElement xmlAttributeElement) { ServiceManager.getService(project, SQLRefRepository.class) .addXmlFileInformationToRepository(refID, xmlFile, xmlAttributeElement); xmlRefCount++; } }; SQLRefXmlVisitor.getInstance(project) .setXmlVisitorListener(xmlVisitorListener) .setInspector(false); SQLRefXmlVisitor.getInstance(project) .visitFile(AnnRefApplication.getPsiFileFromVirtualFile(xmlFile, project)); parseXmlForSql(xmlFile); } }