private static void processReferences(final PsiPlainTextFile file, final PsiReferenceProcessor processor) {
    final Project project = file.getProject();
    final XmlTag rootTag = ReadAction.compute(() -> {
      final XmlFile xmlFile = (XmlFile)PsiFileFactory.getInstance(project)
        .createFileFromText("a.xml", XmlFileType.INSTANCE, file.getViewProvider().getContents());
      return xmlFile.getRootTag();
    });

    if (rootTag == null || !Utils.FORM_NAMESPACE.equals(rootTag.getNamespace())) {
      return;
    }

    final @NonNls String name = rootTag.getName();
    if (!"form".equals(name)){
      return;
    }

    PsiReference classReference = null;

    final XmlAttribute classToBind = rootTag.getAttribute("bind-to-class", null);
    if (classToBind != null) {
      // reference to class
      final XmlAttributeValue valueElement = classToBind.getValueElement();
      if (valueElement == null) {
        return;
      }
      final String className = valueElement.getValue().replace('$','.');
      final PsiReference[] referencesByString = new JavaClassReferenceProvider().getReferencesByString(className, file, valueElement.getTextRange().getStartOffset() + 1);
      if(referencesByString.length < 1){
        // There are no references there
        return;
      }
      for (PsiReference aReferencesByString : referencesByString) {
        processor.execute(aReferencesByString);
      }
      classReference = referencesByString[referencesByString.length - 1];
    }

    processReferences(rootTag, classReference, file, processor);
  }
private static void processReferences(final PsiPlainTextFile file, final PsiReferenceProcessor processor)